Back to top

Ticoplaces

This are the docs for the ticoplaces API, all the resources and how to use it.

Authentication

Authentication

Resource for Authenticating and creating an User

Sign In
POST/auth

Registration for new user

Example URI

POST /auth
Request  creates a person for that user
HideShow

POST  /api/v1/auth

Headers
Content-Type: application/x-www-form-urlencoded
Body
registration%5Bemail%5D=billgates%40email.com&registration%5Bpassword%5D=password&registration%5Bpassword_confirmation%5D=password&registration%5Bperson_attributes%5D%5Bbirth_date%5D=12-12-2000&registration%5Bperson_attributes%5D%5Bfirst_name%5D=Bill&registration%5Bperson_attributes%5D%5Blast_name%5D=Gates&registration%5Bperson_attributes%5D%5Bphone_number%5D=1234567890&registration%5Busername%5D=billgates
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "status": "success",
  "data": {
    "id": 26,
    "provider": "email",
    "uid": "billgates@email.com",
    "allow_password_change": false,
    "username": "billgates",
    "image": null,
    "email": "billgates@email.com",
    "created_at": "2019-04-07T16:44:30.000Z",
    "updated_at": "2019-04-07T16:44:30.000Z"
  }
}
Request  returns status code ok
HideShow

POST  /api/v1/auth

Headers
Content-Type: application/x-www-form-urlencoded
Body
registration%5Bemail%5D=billgates%40email.com&registration%5Bpassword%5D=password&registration%5Bpassword_confirmation%5D=password&registration%5Bperson_attributes%5D%5Bbirth_date%5D=12-12-2000&registration%5Bperson_attributes%5D%5Bfirst_name%5D=Bill&registration%5Bperson_attributes%5D%5Blast_name%5D=Gates&registration%5Bperson_attributes%5D%5Bphone_number%5D=1234567890&registration%5Busername%5D=billgates
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "status": "success",
  "data": {
    "id": 27,
    "provider": "email",
    "uid": "billgates@email.com",
    "allow_password_change": false,
    "username": "billgates",
    "image": null,
    "email": "billgates@email.com",
    "created_at": "2019-04-07T16:44:30.000Z",
    "updated_at": "2019-04-07T16:44:30.000Z"
  }
}
Request  creates an empty person for that user
HideShow

POST  /api/v1/auth

Headers
Content-Type: application/x-www-form-urlencoded
Body
registration%5Bemail%5D=billgates%40email.com&registration%5Bpassword%5D=password&registration%5Bpassword_confirmation%5D=password&registration%5Busername%5D=billgates
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "status": "success",
  "data": {
    "id": 28,
    "provider": "email",
    "uid": "billgates@email.com",
    "allow_password_change": false,
    "username": "billgates",
    "image": null,
    "email": "billgates@email.com",
    "created_at": "2019-04-07T16:44:30.000Z",
    "updated_at": "2019-04-07T16:44:30.000Z"
  }
}
Request  returns status code ok
HideShow

POST  /api/v1/auth

Headers
Content-Type: application/x-www-form-urlencoded
Body
registration%5Bemail%5D=billgates%40email.com&registration%5Bpassword%5D=password&registration%5Bpassword_confirmation%5D=password&registration%5Busername%5D=billgates
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "status": "success",
  "data": {
    "id": 29,
    "provider": "email",
    "uid": "billgates@email.com",
    "allow_password_change": false,
    "username": "billgates",
    "image": null,
    "email": "billgates@email.com",
    "created_at": "2019-04-07T16:44:30.000Z",
    "updated_at": "2019-04-07T16:44:30.000Z"
  }
}

Update User Info
PUT/auth

Update info for existing user

Example URI

PUT /auth
Request  also updates his personal information
HideShow

PUT  /api/v1/auth

Headers
Content-Type: application/x-www-form-urlencoded
Body
registration%5Bperson_attributes%5D%5Bfirst_name%5D=my_new_first_name&registration%5Buser_id%5D=30
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "status": "success",
  "data": {
    "id": 30,
    "email": "billiekemmer@stroman.io",
    "provider": "email",
    "username": "billie",
    "uid": "billiekemmer@stroman.io",
    "allow_password_change": false,
    "image": null,
    "created_at": "2019-04-07T16:44:30.000Z",
    "updated_at": "2019-04-07T16:44:30.000Z"
  }
}

Cantons

Cantons

Resource for Canton

Get cantons
GET/api/v1/cantons

Example URI

GET /api/v1/cantons
Request  returns a success response
HideShow

GET  /api/v1/cantons

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a canton
GET/api/v1/cantons/{id}

Example URI

GET /api/v1/cantons/1
URI Parameters
HideShow
id
number (required) Example: 1
Request  returns a success response
HideShow

GET  /api/v1/cantons/1

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 1,
  "name": "Local 1",
  "description": "description 1",
  "province": "San José",
  "featured_places": []
}

Create a canton
POST/api/v1/cantons

Example URI

POST /api/v1/cantons
Request  creates a canton
HideShow

POST  /api/v1/cantons

Headers
Content-Type: application/x-www-form-urlencoded
Body
canton%5Bdescription%5D=description+1&canton%5Bname%5D=Canton+1&canton%5Bprovince_id%5D=2
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 2,
  "name": "Canton 1",
  "description": "description 1",
  "province": "San José",
  "featured_places": []
}

Update a canton
PUT/api/v1/cantons/{id}

Example URI

PUT /api/v1/cantons/5
URI Parameters
HideShow
id
number (required) Example: 5
Request  updates the requested canton
HideShow

PUT  /api/v1/cantons/5

Headers
Content-Type: application/x-www-form-urlencoded
Body
canton%5Bdescription%5D=description+2&canton%5Bname%5D=Canton+2
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 5,
  "name": "Canton 2",
  "description": "description 2",
  "province": "San José",
  "featured_places": []
}

Delete a canton
DELETE/api/v1/cantons/{id}

Example URI

DELETE /api/v1/cantons/8
URI Parameters
HideShow
id
number (required) Example: 8
Request  destroys the requested canton
HideShow

DELETE  /api/v1/cantons/8

Headers
Content-Type: application/x-www-form-urlencoded
Response  204
HideShow
Body
{
  "id": 8,
  "name": "Local 1",
  "description": "description 1",
  "province": "San José",
  "featured_places": []
}

Categories

Categories

Resource for Category

Get categories
GET/api/v1/categories

Example URI

GET /api/v1/categories
Request  returns a success response
HideShow

GET  /api/v1/categories

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a category
GET/api/v1/categories/{id}

Example URI

GET /api/v1/categories/1
URI Parameters
HideShow
id
number (required) Example: 1
Request  returns a success response
HideShow

GET  /api/v1/categories/1

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 1,
  "name": "Category 1",
  "subcategories": [],
  "places": []
}

Create a category
POST/api/v1/categories

Example URI

POST /api/v1/categories
Request  creates a new Category
HideShow

POST  /api/v1/categories

Headers
Content-Type: application/x-www-form-urlencoded
Body
category%5Bname%5D=Category+1
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 2,
  "name": "Category 1",
  "subcategories": [],
  "places": []
}
Request  renders a JSON response with the new category
HideShow

POST  /api/v1/categories

Headers
Content-Type: application/x-www-form-urlencoded
Body
category%5Bname%5D=Category+1
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 3,
  "name": "Category 1",
  "subcategories": [],
  "places": []
}

Update a category
PUT/api/v1/categories/{id}

Example URI

PUT /api/v1/categories/4
URI Parameters
HideShow
id
number (required) Example: 4
Request  updates the requested category
HideShow

PUT  /api/v1/categories/4

Headers
Content-Type: application/x-www-form-urlencoded
Body
category%5Bname%5D=Category+2
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 4,
  "name": "Category 2",
  "subcategories": [],
  "places": []
}

Delete a category
DELETE/api/v1/categories/{id}

Example URI

DELETE /api/v1/categories/7
URI Parameters
HideShow
id
number (required) Example: 7
Request  destroys the requested category
HideShow

DELETE  /api/v1/categories/7

Headers
Content-Type: application/x-www-form-urlencoded
Response  204
HideShow
Body
{
  "id": 7,
  "name": "Category 1",
  "subcategories": [],
  "places": []
}

Districts

Districts

Resource for District

Get districts
GET/api/v1/districts

Example URI

GET /api/v1/districts
Request  returns a success response
HideShow

GET  /api/v1/districts

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a district
GET/api/v1/districts/{id}

Example URI

GET /api/v1/districts/1
URI Parameters
HideShow
id
number (required) Example: 1
Request  returns a success response
HideShow

GET  /api/v1/districts/1

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 1,
  "name": "District 1",
  "description": "description 1",
  "canton": "South Tod",
  "province": "San José",
  "featured_places": []
}

Create a district
POST/api/v1/districts

Example URI

POST /api/v1/districts
Request  creates a district
HideShow

POST  /api/v1/districts

Headers
Content-Type: application/x-www-form-urlencoded
Body
district%5Bcanton_id%5D=10&district%5Bdescription%5D=description+1&district%5Bname%5D=District+1
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 2,
  "name": "District 1",
  "description": "description 1",
  "canton": "Virgenshire",
  "province": "San José",
  "featured_places": []
}
Request  returns status code created
HideShow

POST  /api/v1/districts

Headers
Content-Type: application/x-www-form-urlencoded
Body
district%5Bcanton_id%5D=11&district%5Bdescription%5D=description+1&district%5Bname%5D=District+1
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 3,
  "name": "District 1",
  "description": "description 1",
  "canton": "Port Nedport",
  "province": "San José",
  "featured_places": []
}
Request  validate @district
HideShow

POST  /api/v1/districts

Headers
Content-Type: application/x-www-form-urlencoded
Body
district%5Bcanton_id%5D=12&district%5Bdescription%5D=description+1&district%5Bname%5D=District+1
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 4,
  "name": "District 1",
  "description": "description 1",
  "canton": "New Giamouth",
  "province": "San José",
  "featured_places": []
}

Update a district
PUT/api/v1/districts/{id}

Example URI

PUT /api/v1/districts/5
URI Parameters
HideShow
id
number (required) Example: 5
Request  updates the requested district
HideShow

PUT  /api/v1/districts/5

Headers
Content-Type: application/x-www-form-urlencoded
Body
district%5Bdescription%5D=description+2&district%5Bname%5D=District+2
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 5,
  "name": "District 2",
  "description": "description 2",
  "canton": "Reingerfort",
  "province": "San José",
  "featured_places": []
}
Request  renders a JSON response with the district
HideShow

PUT  /api/v1/districts/6

Headers
Content-Type: application/x-www-form-urlencoded
Body
district%5Bcanton%5D=14&district%5Bdescription%5D=description+1&district%5Bname%5D=District+1
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 6,
  "name": "District 1",
  "description": "description 1",
  "canton": "Marlinview",
  "province": "San José",
  "featured_places": []
}

Delete a district
DELETE/api/v1/districts/{id}

Example URI

DELETE /api/v1/districts/8
URI Parameters
HideShow
id
number (required) Example: 8
Request  destroys the requested district
HideShow

DELETE  /api/v1/districts/8

Headers
Content-Type: application/x-www-form-urlencoded
Response  204
HideShow
Body
{
  "id": 8,
  "name": "District 1",
  "description": "description 1",
  "canton": "East Norbert",
  "province": "San José",
  "featured_places": []
}

Logs

Logs

Resource for Log

Get logs
GET/api/v1/logs

Example URI

GET /api/v1/logs
Request  returns a success response
HideShow

GET  /api/v1/logs

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a log
GET/api/v1/logs/{id}

Example URI

GET /api/v1/logs/1
URI Parameters
HideShow
id
number (required) Example: 1
Request  returns a success response
HideShow

GET  /api/v1/logs/1

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 1,
  "description": null,
  "latitude": "-15.051435",
  "longitude": "0.975676",
  "user": {
    "id": 1,
    "provider": "email",
    "uid": "antoine@hagenes.org",
    "allow_password_change": false,
    "username": "tracy.reinger",
    "image": null,
    "email": "antoine@hagenes.org",
    "created_at": "2019-04-07T16:44:03.000Z",
    "updated_at": "2019-04-07T16:44:03.000Z"
  },
  "place": {
    "id": 1,
    "name": "Green Bar & Grill",
    "telephone": "375.023.8553 x13647",
    "email": "eufemia@hellercormier.org",
    "latitude": "-48.830206",
    "longitude": "-104.146547",
    "address": null,
    "province": "San José",
    "canton": "Diegohaven",
    "district": "Lake Terrellville"
  }
}

Create a log
POST/api/v1/logs

Example URI

POST /api/v1/logs
Request  creates a new Log
HideShow

POST  /api/v1/logs

Headers
Content-Type: application/x-www-form-urlencoded
Body
log%5Blatitude%5D=0.22991655161524704&log%5Blongitude%5D=-150.51870033391273&log%5Bplace%5D=2&log%5Buser%5D=3
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 2,
  "description": null,
  "latitude": "0.229917",
  "longitude": "-150.5187",
  "user": {
    "id": 2,
    "provider": "email",
    "uid": "dustin@lebsack.info",
    "allow_password_change": false,
    "username": "mauro",
    "image": null,
    "email": "dustin@lebsack.info",
    "created_at": "2019-04-07T16:44:03.000Z",
    "updated_at": "2019-04-07T16:44:03.000Z"
  },
  "place": null
}
Request  renders a JSON response with the new log
HideShow

POST  /api/v1/logs

Headers
Content-Type: application/x-www-form-urlencoded
Body
log%5Blatitude%5D=-17.075858327206703&log%5Blongitude%5D=-131.61270512774777&log%5Bplace%5D=3&log%5Buser%5D=5
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 3,
  "description": null,
  "latitude": "-17.075858",
  "longitude": "-131.612705",
  "user": {
    "id": 4,
    "provider": "email",
    "uid": "pasqualesatterfield@monahan.name",
    "allow_password_change": false,
    "username": "carmella",
    "image": null,
    "email": "pasqualesatterfield@monahan.name",
    "created_at": "2019-04-07T16:44:04.000Z",
    "updated_at": "2019-04-07T16:44:04.000Z"
  },
  "place": null
}
Request  renders a JSON response with errors for the new log
HideShow

POST  /api/v1/logs

Headers
Content-Type: application/x-www-form-urlencoded
Body
log%5Blatitude%5D=
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "latitude": [
    "can't be blank"
  ],
  "longitude": [
    "can't be blank"
  ]
}
Request  returns a 401
HideShow

POST  /api/v1/logs

Headers
Content-Type: application/x-www-form-urlencoded
Body
log%5Blatitude%5D=-69.83376199928013&log%5Blongitude%5D=-32.03938149286785&log%5Bplace%5D=4&log%5Buser%5D=7
Response  401
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "errors": [
    "You need to sign in or sign up before continuing."
  ]
}

Places

Places

Resource for Place

Get places
GET/api/v1/places

Example URI

GET /api/v1/places
Request  returns a success response
HideShow

GET  /api/v1/places

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a place
GET/api/v1/places/{id}

Example URI

GET /api/v1/places/5
URI Parameters
HideShow
id
number (required) Example: 5
Request  returns a success response
HideShow

GET  /api/v1/places/5

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 5,
  "name": "Blue Kitchen",
  "telephone": "673-891-5391",
  "email": "nathaniel@vandervort.info",
  "latitude": "-25.978549",
  "longitude": "130.294171",
  "address": "Northern Territory, Australia",
  "province": "San José",
  "canton": "Port Rogeliomouth",
  "district": "Koelpinville",
  "categories": []
}

Get nearby places 16km radius
GET/api/v1/places/{id}/nearby

Example URI

GET /api/v1/places/7/nearby
URI Parameters
HideShow
id
number (required) Example: 7
Request  returns a success response
HideShow

GET  /api/v1/places/7/nearby

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
[
  {
    "id": 6,
    "name": "La Princesa Marina",
    "telephone": "(782) 462-4400 x7098",
    "email": "raymondlesch@reichert.name",
    "latitude": "9.93446",
    "longitude": "-84.110361",
    "address": "La Princesa Marina, Avenida 4, Rancho Luna, Mata Redonda, Cantón San José, Provincia San José, 10108, Costa Rica",
    "province": "San José",
    "canton": "Port Romeomouth",
    "district": "New Laverne",
    "categories": []
  }
]

Create a place
POST/api/v1/places

Example URI

POST /api/v1/places
Request  creates a place
HideShow

POST  /api/v1/places

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bcanton_id%5D=23&place%5Bdistrict_id%5D=15&place%5Bemail%5D=local1%40example.com&place%5Blatitude%5D=62.92217000316492&place%5Blongitude%5D=-137.04285441376277&place%5Bname%5D=Local+1&place%5Bprovince_id%5D=23&place%5Btelephone%5D=435-604-5688
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 8,
  "name": "Local 1",
  "telephone": "435-604-5688",
  "email": "local1@example.com",
  "latitude": "62.92217",
  "longitude": "-137.042854",
  "address": "Yukon, Canada",
  "province": "San José",
  "canton": "South Young",
  "district": "Letishaburgh",
  "categories": []
}
Request  returns status code created
HideShow

POST  /api/v1/places

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bcanton_id%5D=24&place%5Bdistrict_id%5D=16&place%5Bemail%5D=local1%40example.com&place%5Blatitude%5D=62.24021408944424&place%5Blongitude%5D=148.85120987089618&place%5Bname%5D=Local+1&place%5Bprovince_id%5D=24&place%5Btelephone%5D=435-604-5688
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 9,
  "name": "Local 1",
  "telephone": "435-604-5688",
  "email": "local1@example.com",
  "latitude": "62.240214",
  "longitude": "148.85121",
  "address": "Tenkinsky Urban District, Magadan Oblast, Far Eastern Federal District, Russia",
  "province": "San José",
  "canton": "Eugeneberg",
  "district": "Odisside",
  "categories": []
}
Request  validate place
HideShow

POST  /api/v1/places

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bcanton_id%5D=25&place%5Bdistrict_id%5D=17&place%5Bemail%5D=local1%40example.com&place%5Blatitude%5D=1.4276727279272592&place%5Blongitude%5D=-178.3330879682393&place%5Bname%5D=Local+1&place%5Bprovince_id%5D=25&place%5Btelephone%5D=435-604-5688
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 10,
  "name": "Local 1",
  "telephone": "435-604-5688",
  "email": "local1@example.com",
  "latitude": "1.427673",
  "longitude": "-178.333088",
  "address": null,
  "province": "San José",
  "canton": "West Omarland",
  "district": "Theaside",
  "categories": []
}
Request  return status code unprocessable_entity
HideShow

POST  /api/v1/places

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bname%5D=
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "name": [
    "can't be blank"
  ],
  "telephone": [
    "can't be blank"
  ],
  "email": [
    "can't be blank"
  ],
  "latitude": [
    "can't be blank"
  ],
  "longitude": [
    "can't be blank"
  ],
  "province": [
    "must exist"
  ],
  "canton": [
    "must exist"
  ],
  "district": [
    "must exist"
  ]
}

Update a place
PUT/api/v1/places/{id}

Example URI

PUT /api/v1/places/11
URI Parameters
HideShow
id
number (required) Example: 11
Request  updates the requested place
HideShow

PUT  /api/v1/places/11

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bemail%5D=local2%40example.com&place%5Blatitude%5D=63.073953849062576&place%5Blongitude%5D=128.96612236289116&place%5Bname%5D=Local+2&place%5Btelephone%5D=436-604-5688
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 11,
  "name": "Local 2",
  "telephone": "436-604-5688",
  "email": "local2@example.com",
  "latitude": "63.073954",
  "longitude": "128.966122",
  "address": "Бетюнский наслег, Namsky Ulus, Sakha Republic, Far Eastern Federal District, Russia",
  "province": "San José",
  "canton": "Gutkowskifurt",
  "district": "North Lavernemouth",
  "categories": []
}
Request  renders a JSON response with errors for the place
HideShow

PUT  /api/v1/places/13

Headers
Content-Type: application/x-www-form-urlencoded
Body
place%5Bemail%5D=&place%5Bname%5D=&place%5Btelephone%5D=
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "name": [
    "can't be blank"
  ],
  "telephone": [
    "can't be blank"
  ],
  "email": [
    "can't be blank"
  ]
}

Delete a place
DELETE/api/v1/places/{id}

Example URI

DELETE /api/v1/places/14
URI Parameters
HideShow
id
number (required) Example: 14
Request  destroys the requested place
HideShow

DELETE  /api/v1/places/14

Headers
Content-Type: application/x-www-form-urlencoded
Response  204
HideShow
Body
{
  "id": 14,
  "name": "Blue Pizza",
  "telephone": "371.714.1854",
  "email": "barb@littleshanahan.co",
  "latitude": "46.705475",
  "longitude": "70.007939",
  "address": "Zhanaarka District, Karaganda Region, Kazakhstan",
  "province": "San José",
  "canton": "Lake Clarence",
  "district": "Eldonton",
  "categories": []
}

Reviews

Reviews

Resource for Reviews

Get reviews
GET/api/v1/places/{place_id}/reviews

Example URI

GET /api/v1/places/15/reviews
URI Parameters
HideShow
place_id
number (required) Example: 15
Request  returns a success response
HideShow

GET  /api/v1/places/15/reviews

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8

Get a review
GET/api/v1/places/{place_id}/reviews/{id}

Example URI

GET /api/v1/places/17/reviews/1
URI Parameters
HideShow
place_id
number (required) Example: 17
id
number (required) Example: 1
Request  returns a success response
HideShow

GET  /api/v1/places/17/reviews/1

Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 1,
  "price": "9.99",
  "quality": "9.99",
  "service": "9.99",
  "average_score": "9.99"
}

Create a review
POST/api/v1/places/{place_id}/reviews

Example URI

POST /api/v1/places/18/reviews
URI Parameters
HideShow
place_id
number (required) Example: 18
Request  creates a new Review
HideShow

POST  /api/v1/places/18/reviews

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Baverage_score%5D=9.99&review%5Bplace_id%5D=18&review%5Bprice%5D=9.99&review%5Bquality%5D=9.99&review%5Bservice%5D=9.99&review%5Buser_id%5D=11
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 2,
  "price": "9.99",
  "quality": "9.99",
  "service": "9.99",
  "average_score": "9.99"
}
Request  renders a JSON response with the new review
HideShow

POST  /api/v1/places/19/reviews

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Baverage_score%5D=9.99&review%5Bplace_id%5D=19&review%5Bprice%5D=9.99&review%5Bquality%5D=9.99&review%5Bservice%5D=9.99&review%5Buser_id%5D=13
Response  201
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 3,
  "price": "9.99",
  "quality": "9.99",
  "service": "9.99",
  "average_score": "9.99"
}
Request  renders a JSON response with errors for the new review
HideShow

POST  /api/v1/places/20/reviews

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Bprice%5D=
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "quality": [
    "can't be blank"
  ],
  "service": [
    "can't be blank"
  ],
  "price": [
    "can't be blank"
  ],
  "average_score": [
    "can't be blank"
  ]
}

Update a review
PUT/api/v1/places/{place_id}/reviews/{id}

Example URI

PUT /api/v1/places/22/reviews/4
URI Parameters
HideShow
place_id
number (required) Example: 22
id
number (required) Example: 4
Request  updates the requested review
HideShow

PUT  /api/v1/places/22/reviews/4

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Bprice%5D=2.0
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "quality": [
    "can't be blank"
  ],
  "service": [
    "can't be blank"
  ],
  "average_score": [
    "can't be blank"
  ]
}
Request  renders a JSON response with the review
HideShow

PUT  /api/v1/places/24/reviews/5

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Baverage_score%5D=9.99&review%5Bplace%5D=23&review%5Bprice%5D=9.99&review%5Bquality%5D=9.99&review%5Bservice%5D=9.99&review%5Buser%5D=20
Response  200
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "id": 6,
  "price": "9.99",
  "quality": "9.99",
  "service": "9.99",
  "average_score": "9.99"
}
Request  renders a JSON response with errors for the review
HideShow

PUT  /api/v1/places/26/reviews/7

Headers
Content-Type: application/x-www-form-urlencoded
Body
review%5Bprice%5D=
Response  422
HideShow
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "quality": [
    "can't be blank"
  ],
  "service": [
    "can't be blank"
  ],
  "price": [
    "can't be blank"
  ],
  "average_score": [
    "can't be blank"
  ]
}

Delete a review
DELETE/api/v1/places/{place_id}/reviews/{id}

Example URI

DELETE /api/v1/places/28/reviews/8
URI Parameters
HideShow
place_id
number (required) Example: 28
id
number (required) Example: 8
Request  destroys the requested review
HideShow

DELETE  /api/v1/places/28/reviews/8

Headers
Content-Type: application/x-www-form-urlencoded
Response  204
HideShow
Body
{
  "id": 8,
  "price": "9.99",
  "quality": "9.99",
  "service": "9.99",
  "average_score": "9.99"
}

Generated by aglio on 07 Apr 2019