JSONServer - Gahlot/Training-Module GitHub Wiki
JSON Server
GET Request
- Get all articles
- http://13.232.104.99/articles
- Get single articles
- http://13.232.104.99/articles/1
- Filter articles
- http://13.232.104.99/articles?title=json-server&author=typicode
- http://13.232.104.99/articles?id=1&id=2
- http://13.232.104.99/articles?author.name=typicode
- Paginate Articles
In the Link header you'll get first, prev, next and last links. - http://13.232.104.99/articles?_page=1&_limit=5
- Sort Articles
- http://13.232.104.99/articles?_sort=id&_order=desc
- http://13.232.104.99/articles?_sort=user,id&_order=desc,asc
- Get all comments of a articles
- http://13.232.104.99/articles/1/comments
POST Request
- Add new articles
-
Request Data
{ "title":"My Article", "author":"vineet", "body":"Hey, this is my article" }
-
Add new comment
-
http://13.232.104.99/articles/2/comments
Request Data
{ "author":"vineet", "body":"Hey, this is my new comment" }
PUT Request
- Update article
-
http://13.232.104.99/articles/1
Request Data
{ "title":"My Articles", "author":"vineet", "body":"Hey, this is my edited article" }
-
Update comment
-
http://13.232.104.99/articles/2/comments/1
Request Data
{ "author":"vineet", "body":"Hey, this is my edited comment" }
DELETE Request
- Delete article
PATCH Request
- Patch article body
-
http://13.232.104.99/articles/1
Request Data
{ "body":"Hey, this is my patched article body" }
-
Patch article title & body
-
http://13.232.104.99/articles/1
Request Data
{ "title":"New patch title", "body":"Hey, this is my patched article body" }