Every request and response is in JSON format (Content-Type: application/json
header is required).
The structure following the JSON API specifications.
- GET /seasons
- GET /movies
- GET /contents
- GET /library/?user_id=<user_id>(#library/?user_id=<user_id>)
- POST /contens/<content_id>/purchase
Return the seasons ordered by creation, including the list of episodes ordered by its number.
Example request:
GET /seasons
Example response:
{
"data":[{
"id":"2119",
"type":"season",
"attributes":{
"title":"Jack Kirby'S New Gods",
"plot":"Vitae eveniet tenetur. Provident distinctio tenetur. Officia hic et.",
"created_at":"2019-05-23T20:49:23.011Z"
},
"relationships":{
"episodes":{
"data":[{
"id":"2120",
"type":"episode"
},{
"id":"2121",
"type":"episode"
}]
}
}
}],
"included":[{
"id":"2120",
"type":"episode",
"attributes":{
"title":"It's a Battlefield",
"plot":"All right, Mr. DeMille, I'm ready for my closeup.",
"number":4
}
},{
"id":"2121",
"type":"episode",
"attributes":{
"title":"Mother Night",
"plot":"All right, Mr. DeMille, I'm ready for my closeup.",
"number":5
}
}]
}
Return the movies ordered by creation.
Example request:
GET /movies
Example response:
{
"data":[{
"id":"1",
"type":"movie",
"attributes":{
"title":"The Cricket on the Hearth",
"plot":"Vel sapiente velit. Ut odit dolores.",
"created_at":"2019-05-19T16:00:23.039Z"
}
},{
"id":"2",
"type":"movie",
"attributes":{
"title":"The Skull Beneath the Skin",
"plot":"Distinctio assumenda exercitationem. Qui aut adipisci.",
"created_at":"2019-05-19T16:00:23.059Z"
}
}]
}
Return both movies and seasons ordered by creation.
Example request:
GET /contents
Example response:
{
"data":[{
"id":"2384",
"type":"movie",
"attributes":{
"title":"Vanity Fair",
"plot":"Ad qui velit. Ratione qui accusamus.",
"created_at":"2019-05-24T05:37:54.893Z",
"type":"movie"
}
},{
"id":"2385",
"type":"season",
"attributes":{
"title":"Action Comics",
"plot":"Dignissimos temporibus atque. Pariatur qui officiis.",
"created_at":"2019-05-24T05:37:54.894Z",
"type":"season"
}
}]
}
Get the library of a user ordered by the remaining time to watch the content.
Example request:
GET library/?user_id=1
Example response:
{
"data":[{
"id":"3047",
"type":"library_content",
"attributes":{
"title":"The Millstone",
"plot":"Quod sint quae. Ea officia aut.",
"created_at":"2019-05-24T09:37:25.389Z",
"remaining_time_in_days":1.998139125804757,
"type":"Season"
}
}, {
"id":"3048",
"type":"librar_contenty",
"attributes":{
"title":"The New Frontier",
"plot":"In minus sed. Optio beatae occaecati. Sit ut quibusdam. Quae corporis maiores.",
"created_at":"2019-05-24T09:37:25.399Z",
"remaining_time_in_days":1.7091809973425787,
"type":"Season"
}
}]
}
User can purchase of a content.
Parameters:
user_id
: Who do the purchasecontent_id
: Which content what we want to purchasepurchase_option_id
: Whit which purchase option
Example request:
POST /contents/2/purchase
{
"user_id":"1"
"purchase_option_id":"2"
}