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/9Get user details
PUT|PATCH /public/v2/users/9Update user details
DELETE /public/v2/users/9Delete user

Nested Resources

GET /public/v2/users/9/postsRetrieves user posts
GET /public/v2/posts/9/commentsRetrieves post comments
GET /public/v2/users/9/todosRetrieves user todos
POST /public/v2/users/9/postsCreates a user post
POST /public/v2/posts/9/commentsCreates a post comment
POST /public/v2/users/9/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":"tenali.ramakrishna@15ce.com", "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/9" -d '{"name":"Allasani Peddana", "email":"allasani.peddana@15ce.com", "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/9"

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: 9) { 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: \"tenali.ramakrishna@15ce.com\" 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: 9 name: \"Allasani Peddana\" email: \"allasani.peddana@15ce.com\" 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: 9}){user {id name email gender status}}}"}'

REST API Http Response Codes