A simple API that allows to register and list all the movie directors having an account on Livestream.
This project is written in TypeScript so first of all you need to install it:
npm install -g typescript
And for TypeScript definitions:
npm install -g tsd
Automatic build with gulp:
npm install -g gulp
Automatic tests with mocha:
npm install -g mocha
Default gulp task will compile, test and run server for you (be careful database tests use flushdb
):
npm install
tsd install
redis-server
gulp
Returns Directors collection.
-
URL /directors
-
Method:
GET
-
URL Params
None
-
Data Params
None
-
Success Response:
- Code: 200 OK
Content-Type: application/json
Content:
- Code: 200 OK
{
[
...
{
"livestream_id": 6488818,
"full_name": "Steven Speilberg",
"dob": "2012-06-26T06:07:15.000Z",
"favorite_camera": "Sony F65",
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
...
]
}
-
Error Response:
- Code: 500 Internal Server Error
- Code: 500 Internal Server Error
Returns added entry.
-
URL /directors
-
Method:
POST
-
URL Parans
None
-
Data Params
- Content-Type: application/json
Content:
- Content-Type: application/json
{
// Required {Number}
"livestream_id": 6488818,
// Optional {String}
"favorite_camera": "Sony F65",
// Optional {Array}
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
-
Success Response:
- Code: 201 Created
Content-Type: application/json
Content:
- Code: 201 Created
{
"livestream_id": 6488818,
"full_name": "Steven Speilberg",
"dob": "2012-06-26T06:07:15.000Z",
"favorite_camera": "Sony F65",
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
-
Error Response:
-
Code: 400 Bad Request
-
Code: 404 Not Found
-
Code: 500 Internal Server Error
-
Returns Directors collection entry for specified id of type {Number}.
-
URL /directors/:id
-
Method:
GET
-
URL Params
None
-
Data Params
None
-
Success Response:
- Code: 200 OK
Content-Type: application/json
Content:
- Code: 200 OK
{
// Optional, immutable {Number}
"livestream_id": 6488818,
// Optional, immutable {String}
"full_name": "Steven Speilberg",
// Optional, immutable {String}
"dob": "2012-06-26T06:07:15.000Z",
// Optional {String}
"favorite_camera": "Sony F65",
// Optional {Array}
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
-
Error Response:
-
Code: 404 Not Found
-
Code: 500 Internal Server Error
-
Returns updated entry for specified id of type {Number}. Requiers authorization: Bearer md5(full_name)
-
URL /directors/:id
-
Method:
PUT
-
URL Parans
None
-
Data Params
- Content-Type: application/json
Authorization: Bearer f2455fa1321940cef8ea0d5c0e60d800
Content:
- Content-Type: application/json
{
// Optional {String}
"favorite_camera": "Sony F65",
// Optional {Array} of {String}
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
-
Success Response:
- Code: 200 OK
Content-Type: application/json
Content:
- Code: 200 OK
{
"livestream_id": 6488818,
"full_name": "Steven Speilberg",
"dob": "2012-06-26T06:07:15.000Z",
"favorite_camera": "Sony F65",
"favorite_movies": [
"Catch Me If You Can",
"The Terminal"
]
}
-
Error Response:
-
Code: 400 Bad Request
-
Code: 401 Unauthorized
-
Code: 404 Not Found
-
Code: 500 Internal Server Error
-
Removes entry for specified id of type {Number}. Requiers authorization: Bearer md5(full_name)
-
URL /directors/:id
-
Method:
DELETE
-
URL Params
None
-
Data Params
- Content-Type: application/json
Authorization: Bearer f2455fa1321940cef8ea0d5c0e60d800
- Content-Type: application/json
-
Success Response:
- Code: 204 No Content
- Code: 204 No Content
-
Error Response:
-
Code: 401 Unauthorized
-
Code: 404 Not Found
-
Code: 500 Internal Server Error
-