-
Notifications
You must be signed in to change notification settings - Fork 1
API Documentation
Chitkarsh Gandhi edited this page Oct 23, 2018
·
1 revision
The following are the API's for this application.
- Root endpoint (/) eg: http:localhost:5002/
- Get List of all Movies (/getMovies)
- Search for Movies (/findMovies)
Search for movie endpoint takes arguements for searching the type of movie Argument params can be
- /findMovies?name=
- /findMovies?director=
- /findMovies?genre=
- /findMovies?popularity=<int number form 0 to 100>
- /findMovies?imdb_score=<float value from 0 to 10>
Note: Search can be performed only on 1 parameter at this time. Cross filtering is not yet supported
Admin Users need to authenticate for using these specific api's The authentication used in this application is token based (JWT token)
On Accessing the /auth (POST) endpoint with username and password, the application will respond with access token Sample request:
curl -X POST \
http://localhost:5002/auth \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{"username":"admin123","password":"dwp8102noitacilppaeivom"}'
Response
{'access_token' : 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eSI6MSwiaWF0IjoxNTQwMjE'}
This token needs to be passed in header as Authorization : JWT
The following are the API that Admins can access
- /insertMovie
- /updateMovie
- /deleteMovie
Sample requests for all are as below:
Insert Movie
curl -X POST \
http://localhost:5002/insertMovie \
-H 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eSI6MSwiaWF0IjoxNTQwMjE3MDM3LCJuYmYiOjE1NDAyMTcwMzcsImV4cCI6MTU0MDIyMDAzN30.2suEWIPV3GKF1GjBmIvrLswyRFCoC2BEdBhjTPKMmgk' \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-H 'postman-token: fd535476-19a8-874a-872e-4c03286a16ee'
Params in body:
name:The Wizard of O
director:Victor Fleming
popularity:83
imdb_score:8.3
genres[]:Adventure
genres[]:Family
genres[]:Fantasy
Delete Movie:
curl -X POST \
http://localhost:5002/deleteMovie \
-H 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eSI6MSwiaWF0IjoxNTQwMjEzMDc1LCJuYmYiOjE1NDAyMTMwNzUsImV4cCI6MTU0MDIxNjA3NX0.3vgVPYggHXLnxkwmG56B1vTD2GvGGP3eU2mnChWlDlQ' \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
Params:
name:The Wizard of Oz