Skip to content

Instantly share code, notes, and snippets.

@mattumland
Last active May 15, 2021 01:13
Show Gist options
  • Save mattumland/ac182b0ba8bc5a4f224286a1f656edd3 to your computer and use it in GitHub Desktop.
Save mattumland/ac182b0ba8bc5a4f224286a1f656edd3 to your computer and use it in GitHub Desktop.

What2Watch API Contract

Endpoints

https://docs.google.com/spreadsheets/d/1zy9m7Cki6nyBcCNDiKw1RR7FTl4C145VHpau-H8x_CU/edit#gid=0

JSON Responses

Users

GET /api/v1/users

{
  "data": {
      "id": "1",
      "type": "user",
      "attributes": {
          "email": "[email protected]",
          "region": {
              "id": 1,
              "full_name": "United State of America",
              "abbreviation: "US"
           }
        },
      "language": {
          "id": 1,
          "english_name": "spanish",
          "name": "espanol",
          "abbreviation": "es"
       },
      "watchlist": { 
        "id": "342",
        "saved_movies":
          [  
           {"id":"10", "title":"Movie film", "poster":"path/movietitle"}
          ]
        },
      "recommendations": 
        [
          {
          "id":"10", 
          "title":"Movie film", 
          "poster":"path/movietitle.png", 
          }
        ]
      }
    }
}

Movie Details

api/v1/movie?movieID

{
 "data": {
    "id":"10",
    "type":"movie",
    "attributes": {
      "title":"Movie film", 
      "poster":"path/movietitle.png",
      "genres":["action","buddy comedy"],
      "cast":["Bill Movie-Star"],
      "user_review":"7.8",
      "release_date":"1984-09-25",
      "synopsis": "A movie of epic movieness",
      "services": 
        [
          {"id":"1619", "name":"nutflex", "icon": "service/icon.png"}
        ]
      }
  }

Sad Path Response (no data matches query)

  {
    "data": {}
  }

Edge Case Response (weird data)

{
  "error": "error message"
}
HTTP verbs Paths Used for Output
POST /api/v1/users Create a new user json
GET /api/v1/yards/:yard_id Get a yard's show page json
POST /api/v1/yards Create a new yard json
DELETE /api/v1/yards/:yard_id Delete a yard details
PUT /api/v1/yards/:yard_id Update a yard json
GET /api/v1/hosts/host_id/bookings?status=STATUS Get all bookings for a host that have a particular status json
GET /api/v1/renters/renter_id/bookings?status=STATUS Get all bookings for a renter that have a particular status json
GET /api/v1/yards?location=ZIP&purposes=PURPOSE+NAME&OTHER+PURPOSE+NAME Get yards that match search criteria. json
GET /api/v1/hosts/host_id/yards Get yards that belong to a host json
GET /api/v1/yards/:yard_id/bookings Get bookings that belong to a specific yard json
POST /api/v1/bookings Create a new booking json
GET /api/v1/bookings/:booking_id Get booking show page json
DELETE /api/v1/bookings/:booking_id Delete a new booking details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment