Queries
users
Returns [User!]!.
query { users { id name job city } }{
"data": {
"users": [
{"id": 101, "name": "Hiroshi Tanaka", "job": "Engineer", "city": "Tokyo"},
{"id": 102, "name": "Maria Gonzales", "job": "Doctor", "city": "Madrid"},
"… 2 more items"
]
}
}user
Returns User. Arguments: id (Int!).
query { user(id: 1) { id name job city } }{"data": {"user": null}}products
Returns [Product!]!. Arguments: category (String).
query { products(category: "electronics") { id title price description category } }{
"data": {
"products": [
{
"id": 1,
"title": "Wireless Noise-Cancelling Headphones",
"price": 249.99,
"description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
"category": "electronics"
},
{
"id": 2,
"title": "Smartwatch Series 6",
"price": 199.99,
"description": "Fitness tracking, heart-rate monitor, and always-on OLED display.",
"category": "electronics"
},
"… 6 more items"
… (3 more lines)product
Returns Product. Arguments: id (Int!).
query { product(id: 1) { id title price description category } }{
"data": {
"product": {
"id": 1,
"title": "Wireless Noise-Cancelling Headphones",
"price": 249.99,
"description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
"category": "electronics"
}
}
}posts
Returns [Post!]!. Arguments: userId (Int).
query { posts(userId: 101) { id userId title body tags } }{
"data": {
"posts": [
{
"id": 1,
"userId": 101,
"title": "Getting Started with REST APIs",
"body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and reques…
"tags": ["api", "tutorial", "beginner"]
},
{
"id": 4,
"userId": 101,
"title": "10 Git Commands Every Developer Should Know",
"body": "Beyond commit and push, these ten Git commands will make you faster and more confident, from reflog to interactive rebase.",
"tags": ["git", "productivity", "tools"]
},
"… 3 more items
… (3 more lines)post
Returns Post. Arguments: id (Int!).
query { post(id: 1) { id userId title body tags } }{
"data": {
"post": {
"id": 1,
"userId": 101,
"title": "Getting Started with REST APIs",
"body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and request/…
"tags": ["api", "tutorial", "beginner]
}
}
}todos
Returns [Todo!]!. Arguments: completed (Boolean).
query { todos(completed: true) { id userId title completed priority } }{
"data": {
"todos": [
{
"id": 3,
"userId": 102,
"title": "Prepare sprint demo",
"completed": true,
"priority": "high"
},
{
"id": 6,
"userId": 103,
"title": "Set up CI/CD pipeline",
"completed": true,
"priority": "medium"
},
"… 9 more items"
… (3 more lines)employees
Returns [Employee!]!. Arguments: department (String).
query { employees(department: "Executive") { id firstName lastName email phone } }{
"data": {
"employees": [
{
"id": 1,
"firstName": "Olivia",
"lastName": "Bennett",
"email": "olivia.bennett@nimbuscloud.example.com",
"phone": "+1-555-101-1037"
},
{
"id": 7,
"firstName": "Sophia",
"lastName": "Hughes",
"email": "sophia.hughes@greenleaffoods.example.com",
"phone": "+1-555-107-1259"
},
"… 6 more items"
… (3 more lines)employee
Returns Employee. Arguments: id (Int!).
query { employee(id: 1) { id firstName lastName email phone } }{
"data": {
"employee": {
"id": 1,
"firstName": "Olivia",
"lastName": "Bennett",
"email": "olivia.bennett@nimbuscloud.example.com",
"phone": "+1-555-101-1037"
}
}
}companies
Returns [Company!]!.
query { companies { id name industry founded website } }{
"data": {
"companies": [
{
"id": 1,
"name": "Nimbus Cloud Systems",
"industry": "Technology",
"founded": 2008,
"website": "https://nimbuscloud.example.com"
},
{
"id": 2,
"name": "Greenleaf Foods",
"industry": "Food & Beverage",
"founded": 1994,
"website": "https://greenleaffoods.example.com"
},
"… 8 more items"
… (3 more lines)books
Returns [Book!]!. Arguments: genre (String).
query { books(genre: "Drama") { id title author isbn genre } }{"data": {"books": []}}book
Returns Book. Arguments: id (Int!).
query { book(id: 1) { id title author isbn genre } }{
"data": {
"book": {
"id": 1,
"title": "Clean Code",
"author": "Robert C. Martin",
"isbn": "9780132350884",
"genre": "programming"
}
}
}movies
Returns [Movie!]!. Arguments: genre (String).
query { movies(genre: "Drama") { id title director year genres } }{
"data": {
"movies": [
{
"id": 1,
"title": "The Shawshank Redemption",
"director": "Frank Darabont",
"year": 1994,
"genres": ["Drama"]
},
{
"id": 2,
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972,
"genres": ["Crime", "Drama"]
},
"… 14 more items"
… (3 more lines)movie
Returns Movie. Arguments: id (Int!).
query { movie(id: 1) { id title director year genres } }{
"data": {
"movie": {
"id": 1,
"title": "The Shawshank Redemption",
"director": "Frank Darabont",
"year": 1994,
"genres": ["Drama"]
}
}
}countries
Returns [Country!]!. Arguments: region (String).
query { countries(region: "Americas") { id name code code3 capital } }{
"data": {
"countries": [
{
"id": 1,
"name": "United States",
"code": "US",
"code3": "USA",
"capital": "Washington, D.C."
},
{"id": 2, "name": "Canada", "code": "CA", "code3": "CAN", "capital": "Ottawa"},
"… 6 more items"
]
}
}country
Returns Country. Arguments: code (String!).
query { country(code: "IN") { id name code code3 capital } }{
"data": {"country": {"id": 16, "name": "India", "code": "IN", "code3": "IND", "capital": "New Delhi"}}
}people
Returns [Person!]!.
query { people { id firstName lastName username email } }{
"data": {
"people": [
{
"id": 1,
"firstName": "Aisha",
"lastName": "Khan",
"username": "akhan",
"email": "akhan@example.com"
},
{
"id": 2,
"firstName": "Carlos",
"lastName": "Mendes",
"username": "cmendes",
"email": "cmendes@example.com"
},
"… 20 more items"
… (3 more lines)events
Returns [Event!]!. Arguments: category (String).
query { events(category: "electronics") { id name category venue city } }{"data": {"events": []}}albums
Returns [Album!]!. Arguments: userId (Int).
query { albums(userId: 101) { id userId title } }{
"data": {
"albums": [
{"id": 1, "userId": 101, "title": "Summer in Lisbon"},
{"id": 2, "userId": 101, "title": "Office Dogs"},
"… 2 more items"
]
}
}photos
Returns [Photo!]!. Arguments: albumId (Int).
query { photos(albumId: 1) { id albumId title url thumbnailUrl } }{
"data": {
"photos": [
{
"id": 1,
"albumId": 1,
"title": "Summer in Lisbon - sunrise #1",
"url": "https://picsum.photos/seed/photo1/600/600",
"thumbnailUrl": "https://picsum.photos/seed/photo1/150/150"
},
{
"id": 2,
"albumId": 1,
"title": "Summer in Lisbon - close-up #2",
"url": "https://picsum.photos/seed/photo2/600/600",
"thumbnailUrl": "https://picsum.photos/seed/photo2/150/150"
},
"… 5 more items"
… (3 more lines)Mutations
createUser
Returns User!. Arguments: name (String!), job (String!), city (String!).
mutation { createUser(name: "Asha", job: "Engineer", city: "Pune") { id name job city } }{"data": {"createUser": {"id": 7970, "name": "Asha", "job": "Engineer", "city": "Pune"}}}updateUser
Returns User. Arguments: id (Int!), name (String!), job (String!), city (String!).
mutation { updateUser(id: 1, name: "Asha", job: "Engineer", city: "Pune") { id name job city } }{"data": {"updateUser": null}}deleteUser
Returns String!. Arguments: id (Int!).
mutation { deleteUser(id: 1) }{"data": {"deleteUser": "User 1 not found"}}addTodo
Returns Todo!. Arguments: title (String!), userId (Int!), priority (String!).
mutation { addTodo(title: "Write docs", userId: 101, priority: "high") { id userId title completed priority } }{
"data": {
"addTodo": {"id": 35, "userId": 101, "title": "Write docs", "completed": false, "priority": "high"}
}
}toggleTodo
Returns Todo. Arguments: id (Int!).
mutation { toggleTodo(id: 30) { id userId title completed priority } }{
"data": {
"toggleTodo": {
"id": 30,
"userId": 110,
"title": "Schedule stakeholder review",
"completed": false,
"priority": "low"
}
}
}deleteTodo
Returns Boolean!. Arguments: id (Int!).
mutation { deleteTodo(id: 30) }{"data": {"deleteTodo": true}}Types
| Type | Fields |
|---|---|
| Photo | id: Int!, albumId: Int!, title: String!, url: String!, thumbnailUrl: String! |
| CompanyHeadquarters | city: String!, country: String! |
| Post | id: Int!, userId: Int!, title: String!, body: String!, tags: [String!]!, publishedAt: String!, likes: Int! |
| GeoLocation | lat: Float!, lng: Float! |
| Book | id: Int!, title: String!, author: String!, isbn: String!, genre: String!, publishedYear: Int!, pages: Int!, language: String!, price: Decimal!, rating: Float!, available: Boolean!, tags: [String!]! |
| CountryCurrency | code: String!, name: String!, symbol: String! |
| Person | id: Int!, firstName: String!, lastName: String!, username: String!, email: String!, gender: String!, dateOfBirth: String!, phone: String!, avatar: String!, address: Address!, company: PersonCompany! |
| PersonCompany | name: String!, title: String! |
| Album | id: Int!, userId: Int!, title: String! |
| Movie | id: Int!, title: String!, director: String!, year: Int!, genres: [String!]!, runtimeMinutes: Int!, rating: Float!, cast: [String!]!, boxOffice: Long!, poster: String! |
| Todo | id: Int!, userId: Int!, title: String!, completed: Boolean!, priority: String!, dueDate: String! |
| Company | id: Int!, name: String!, industry: String!, founded: Int!, website: String!, headquarters: CompanyHeadquarters!, revenue: Decimal!, employeeCount: Int! |
| Product | id: Int!, title: String!, price: Decimal!, description: String!, category: String!, image: String!, rating: Rating!, inStock: Boolean!, createdAt: String! |
| Address | street: String!, city: String!, state: String!, zip: String!, country: String!, geo: GeoLocation |
| User | id: Int!, name: String!, job: String!, city: String! |
| Country | id: Int!, name: String!, code: String!, code3: String!, capital: String!, region: String!, population: Long!, area: Float!, currency: CountryCurrency!, languages: [String!]!, callingCode: String!, flag: String!, timezones: [String!]! |
| Rating | rate: Float!, count: Int! |
| Employee | id: Int!, firstName: String!, lastName: String!, email: String!, phone: String!, department: String!, title: String!, salary: Decimal!, hireDate: String!, managerId: Int, companyId: Int!, skills: [String!]!, address: Address!, active: Boolean! |
| Event | id: Int!, name: String!, category: String!, venue: String!, city: String!, startsAt: String!, endsAt: String!, price: Decimal!, capacity: Int!, ticketsSold: Int!, organizer: String!, tags: [String!]! |