Skip to main content
Back to Challenges
📊

GraphQL API

Query and mutate data with a flexible GraphQL schema

Endpoint:https://api.qa-practice.dev/api/graphql

Query Editor

Example Queries

QueryGet All Users
query {
  users {
    id
    name
    email
    createdAt
  }
}
QueryGet Products with Filter
query {
  products(category: "electronics", inStock: true) {
    id
    name
    price
    category
    inStock
  }
}
QueryGet User with Posts
query {
  user(id: "1") {
    id
    name
    email
    posts {
      id
      title
    }
    orders {
      id
      status
      total
    }
  }
}
MutationCreate User
mutation {
  createUser(name: "John Doe", email: "john@example.com") {
    id
    name
    email
    createdAt
  }
}
MutationLogin
mutation {
  login(email: "test@example.com", password: "password123") {
    token
    user {
      id
      email
      name
    }
  }
}
MutationCreate Order
mutation {
  createOrder(
    userId: "1"
    items: [
      { productId: "1", quantity: 2 }
      { productId: "2", quantity: 1 }
    ]
  ) {
    id
    status
    total
    items {
      productId
      quantity
      price
    }
  }
}

Available Types

Queries

  • users, user(id)
  • posts, post(id)
  • products, product(id)
  • comments, comment(id)
  • orders, order(id)
  • me (authenticated)

Mutations

  • createUser, updateUser, deleteUser
  • createPost, updatePost, deletePost
  • createProduct, updateProduct, deleteProduct
  • createOrder, updateOrderStatus, cancelOrder
  • login, register, logout

Types

  • User (id, name, email, posts, orders)
  • Post (id, title, body, author, comments)
  • Product (id, name, price, category)
  • Order (id, status, total, items)
  • Comment (id, body, author, post)

GraphQL endpoint powered by Apollo Server