TV Shows
HTTP Method | Endpoint | Function |
---|---|---|
GET | /shows | Lists all shows in JSON format |
GET | /shows/{show_id} | Lists a specific show in JSON format |
POST | /shows | Create a new show |
PUT | /shows/{show_id} | Update a specific show |
DELETE | /shows/{show_id} | Delete a specific show |
Sample GET requests and responses
To list your database entries, you must use a GET request.
An example GET request for all entires.
GET http://localhost:8888/shows
An example GET request for a specific database entry.
GET http://localhost:8888/shows/1
Your data will be printed out in JSON format.
{
"id": 1,
"name": "How To Get Away With Murder",
"channel": Netflix",
"genre": "Drama",
"status": "Watching",
"season": "3",
"episode": "1",
"rating": 5,
"picture": "http://www.gstatic.com/tv/thumb/tvbanners/13035972/p13035972_b_v8_ab.jpg"
"created_at": "2017-04-05 18:13:19",
"updated_at": "2017-04-05 18:13:19"
}
Sample POST request and response
To create a new show, you must use a POST request, and certain parameters.
Parameters
- Name: the title of the show
- Channel: the channel the show is on
- Genre: the genre of the show
- Status: the current status of the book - to watch, watching , or watched.
- Season: if you selected 'watching' for status, the current season you're on
- Episode: if you selected 'watching' for status, the current episode you're on
- Rating: rating from 1-5. must be an integer
- Picture: URL of show poster
An example POST request.
POST http://localhost:8888/shows
parameter-name: title
value: How To Get Away With Murder
parameter-name: channel
value: ABC
parameter-name: genre
value: Drama
parameter-name: status
value: Watching
parameter-name: season
value: 3
parameter-name: episode
value: 1
parameter-name: rating
value: 5
parameter-name: picture
value: http://www.gstatic.com/tv/thumb/tvbanners/13035972/p13035972_b_v8_ab.jpg
You will get a message in JSON format alerting you that your book has been created.
{
"created": true
}
Sample PUT request and response
To update a show, you must use a PUT request, the showID, and whichever parameters you which to edit.
An example PUT request.
PUT http://localhost:8888/shows/1
parameter-name: status
value: Watched.
You will get a message in JSON format alerting you that your book has been updated.
{
"updated": true
}
Sample DELETE request and response
To delete a show, you must use a DELETE request and the showID.
DELETE http://localhost:8888/shows/1
You will get a message in JSON format alerting you that your show has been deleted.
{
"deleted": true
}