HTTP
HTTP Methods
- GET
curl http://localhost:3000/movies
curl -X GET http://localhost:3000/movies/2
- POST
curl -X POST -H "Content-Type: application/json" -d '{"title": "Interstellar","year": 2014,"directorId": 101,"genre": ["Sci-Fi", "Adventure"],"cast": ["Matthew McConaughey", "Anne Hathaway"]}' http://localhost:3000/movies
- PUT
curl -X PUT -H "Content-Type: application/json" -d '{ "title": "Interstellar (Updated)", "year": 2015, "directorId": 101, "genre": ["Sci-Fi", "Adventure", "Drama"], "cast": ["Matthew McConaughey", "Anne Hathaway", "Jessica Chastain"]}' http://localhost:3000/movies/4
- DELETE
curl -X DELETE http://localhost:3000/movies/4
Query
Pagination
curl "http://localhost:3000/movies?\_page=1"
curl "http://localhost:3000/movies?\_page=1&_limit=20"
Filtering
curl "http://localhost:3000/movies?director=Christopher%20Nolan"
Sort
curl "http://localhost:3000/movies?_sort=year&_order=desc"
Operators
Add _gte
or _lte
for getting a range
curl "http://localhost:3000/movies?year_gte=1980&year_lte=1990"
Add _ne
to exclude a value
curl "http://localhost:3000/movies?director_ne=Christopher%20Nolan"