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

Nested Resources

GET /public/v2/users/6942340/postsRetrieves user posts
GET /public/v2/posts/6942340/commentsRetrieves post comments
GET /public/v2/users/6942340/todosRetrieves user todos
POST /public/v2/users/6942340/postsCreates a user post
POST /public/v2/posts/6942340/commentsCreates a post comment
POST /public/v2/users/6942340/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/6942340" -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/6942340"

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: 6942340) { 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: 6942340 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: 6942340}){user {id name email gender status}}}"}'

REST API Http Response Codes