Welcome
GraphQLPlaceholder is a free online GraphQL implementation of the popular JSON Placeholder RESTful API. GraphQLPlaceholder offers a dynamic GraphQL playground designed for testing and experimentation, providing developers with an easy-to-use platform for generating fake data on demand.
Whether you're working on tutorials, testing new libraries, or sharing code examples, GraphQLPlaceholder is an invaluable tool for developers looking to streamline their workflows and enhance their coding practices. It can be used in a README on GitHub, for a demo on CodeSandbox, in code examples on Stack Overflow, or simply to test things locally.
Try it
Run this code in a console or from any site:
const query = `
query {
userById(id: 1) {
id
name
email
phone
}
}
`;
fetch('https://graphqlplaceholder.vercel.app/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ query })
})
.then(response => response.json())
.then(json => console.log(json))
Congrats you've made your first call to GraphQLPlaceholder! 😃 🎉
Tip: you can use http:// or https:// when making requests to GraphQLPlaceholder.
Queries
GraphQLPlaceholder comes with a set queries that supports JSONPlaceholder resources:
posts | 100 posts |
comments | 500 comments |
albums | 100 albums |
photos | 5000 photos |
todos | 200 todos |
users | 10 users |
Note: resources have relations. For example: posts have many comments, albums have many photos, ... see guide for the full list..
Mutations
GraphQLPlaceholder currently supports 3 mutations for Post resource.
Post | createPost |
Post | updatePost |
Post | deletePost |
Note: you can view detailed examples here.