GraphQL and REST API for Testing and Prototyping

fake data | real responses | 24/7 online

Trying it Out

POST /public/v2/usersCreate a new user
GET /public/v2/users/2139266Get user details
PUT|PATCH /public/v2/users/2139266Update user details
DELETE /public/v2/users/2139266Delete user

Nested Resources

GET /public/v2/users/2139266/postsRetrieves user posts
GET /public/v2/posts/2139266/commentsRetrieves post comments
GET /public/v2/users/2139266/todosRetrieves user todos
POST /public/v2/users/2139266/postsCreates a user post
POST /public/v2/posts/2139266/commentsCreates a post comment
POST /public/v2/users/2139266/todosCreates a user todo

GraphQL Endpoint

Features

Rate Limiting Headers

  • Customize the rate limit per access token.
  • X-RateLimit-Limit number of allowed requests/minute.
  • X-RateLimit-Remaining remaining requests within the current period.
  • X-RateLimit-Reset seconds to wait before having maximum number of allowed requests again.

Pagination Headers

  • X-Pagination-Total total number of results.
  • X-Pagination-Pages total number of pages.
  • X-Pagination-Page current page number.
  • X-Pagination-Limit results per page.

API Version 2

API Version 1

API Version 0

Authentication

Unlike Web applications, RESTful APIs are usually stateless, which means sessions or cookies should not be used. Therefore, each request should come with some sort of authentication credentials. A common practice is to send a secret access token with each request to authenticate the user. Since an access token can be used to uniquely identify and authenticate a user, API requests should always be sent via HTTPS to prevent man-in-the-middle (MitM) attacks.

There are different ways to send an access token:

cUrl Examples for REST API

List users
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XGET "https://gorest.co.in/public/v2/users"
Create user
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/users" -d '{"name":"Tenali Ramakrishna", "gender":"male", "email":"[email protected]", "status":"active"}'
Update user
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPATCH "https://gorest.co.in/public/v2/users/2139266" -d '{"name":"Allasani Peddana", "email":"[email protected]", "status":"active"}'
Delete user
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XDELETE "https://gorest.co.in/public/v2/users/2139266"

cUrl Examples for GraphQL

List users
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/graphql" -d '{"query":"query{users {pageInfo {endCursor startCursor hasNextPage hasPreviousPage} totalCount nodes {id name email gender status}}}"}'
Get User
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/graphql" -d '{"query":"query{user(id: 2139266) { id name email gender status }}"}'
Create User
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/graphql" -d '{"query":"mutation{createUser(input: {name: \"Tenali Ramakrishna\" gender: \"male\" email: \"[email protected]\" status: \"active\"}) {user{id name gender email status}}}"}'
Update User
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/graphql" -d '{"query":"mutation{updateUser(input: {id: 2139266 name: \"Allasani Peddana\" email: \"[email protected]\" status: \"active\"}) {user{id name gender email status}}}"}'
Delete User
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/graphql" -d '{"query":"mutation{deleteUser(input: {id: 2139266}){user {id name email gender status}}}"}'

REST API Http Response Codes