This is a simple movies API dedicated for Holberton School React Project Holberton School Cinema Guru
200: Success
400: Bad request
401: Unauthorized
404: Cannot be found
405: Method not allowed
422: Unprocessable Entity
50X: Server Error
http code 402
{
"code": 120,
"message": "invalid crendetials",
"resolve": "The username or password is not correct."
}
You send: Your login credentials.
You get: An API-Token
with wich you can make further actions.
Request:
POST api/auth/login HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: xy
{
"username": "foo",
"password": "1234567"
}
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"message":"Logged in successfully",
"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsInVzZXJuYW1lIjoiQXRlZiIsImlhdCI6MTY0OTg2MzQxNCwiZXhwIjoxNjQ5OTQ5ODE0fQ.WPTSn01ooByJsUF44uwwko1zXj6YObSl0XWZeqHuQiI"
}
Failed Response:
HTTP/1.1 401 Unauthorized
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"message": "Invalid crendetials",
}
You send: Your account credentials.
You get: An API-Token
with wich you can make further actions.
Request:
POST api/auth/register HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: xy
{
"username": "foo",
"password": "1234567"
}
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"message":"Registred successfully",
"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsInVzZXJuYW1lIjoiQXRlZiIsImlhdCI6MTY0OTg2MzQxNCwiZXhwIjoxNjQ5OTQ5ODE0fQ.WPTSn01ooByJsUF44uwwko1zXj6YObSl0XWZeqHuQiI"
}
Failed Response:
HTTP/1.1 400 Unauthorized
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"message": "Invalid username",
}
You send: Your login credentials. You get: Your userId and username.
Request:
POST api/auth/ HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
{
"username": "foo",
"password": "1234567"
}
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"userId":5,
"username":"foo"
}
Failed Response:
HTTP/1.1 401 Unauthorized
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"message": "Invalid token",
}
You send: Filters and the sorting. You get: List of movies/shows from DB.
Request:
GET api/titles/advancedsearch HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Parameters | Description | Example |
---|---|---|
maxYear | The maximum year of the movie release | "2022" |
minYear | The minimum year of the movie release | "2020" |
genre | List of genres seperated by a comma | "action,drama,history" |
title | The movie/show title | "The Meg" |
page | The page to query | 2 |
sort | Sort by | "latest", "oldest", "highestrated", "lowestrated" |
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"totalCount": 50
"titles": [{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
}
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: N/A. You get: List of favorited movies/shows from DB.
Request:
GET api/titles/favorite HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: N/A. You get: List of movies/shows to watch later from DB.
Request:
GET api/titles/watchlater HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: The movie IMDB Id. You get: List of all favorited movies.
Request:
POST api/titles/favorite HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Parameters | Description | Example |
---|---|---|
imdbId | Imdb movie/show Id | "tt9899344" |
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: The movie IMDB Id. You get: List of all to watch later movies.
Request:
POST api/titles/watchlater HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Parameters | Description | Example |
---|---|---|
imdbId | Imdb movie/show Id | "tt9899344" |
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: The movie IMDB Id. You get: List of all favorited movies.
Request:
DELETE api/titles/favorite HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Parameters | Description | Example |
---|---|---|
imdbId | Imdb movie/show Id | "tt9899344" |
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: The movie IMDB Id. You get: List of all to watch later movies.
Request:
DELETE api/titles/watchlater HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Parameters | Description | Example |
---|---|---|
imdbId | Imdb movie/show Id | "tt9899344" |
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"createdAt": "2022-03-28T10:02:29.452Z"
"genres": ["Drama"]
"id": 2
"imageurls": [
"https://m.media-amazon.com/images/M/MV5BNzY5Yjg4MDYtNThmOC00ODU0LWIzYjQtOWJhYWFjN2MxZDk0XkEyXkFqcGdeQXVyNDMyNTgyNDQ@._V1_UY268_CR146,0,182,268_AL_.jpg"
]
"imdbId": "tt9899344"
"imdbrating": -1
"quotes": []
"released": 2022
"reviews": []
"runtime": -1
"summary": ""
"synopsis": "Dreamers in a lonely circus."
"title": "GodHead: In a fiction, in a dream of passion"
"trailerUrl": []
"type": "movie"
"updatedAt": "2022-03-28T10:02:29.452Z"
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
You send: N/A. You get: List of recent user activities.
Request:
GET api/activity/ HTTP/1.1
Authorization: "Bearer <accessToken>"
Accept: application/json
Content-Type: application/json
Content-Length: xy
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
[
{
"TitleId": 2
"activityType": "favorite"
"createdAt": "2022-04-13T15:53:26.751Z"
"id": 77
"title": {title: "GodHead: In a fiction, in a dream of passion"}
"updatedAt": "2022-04-13T15:53:26.751Z"
"user": {username: "Atef"}
"userId": 1
},
...
]
Failed Response:
HTTP/1.1 500 Internal Error
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
...
}
- Atef Mechken @atefMck