Scandi‑Market Logo

Scandi‑Market GraphQL API

This GraphQL API powers the e-commerce application built for the Junior Fullstack position test. The backend is developed with object-oriented PHP without frameworks, hosted securely on x10Hosting with SSL certification. Below you'll find complete documentation for interacting with the API.

How to Use

Send a POST request to:

https://scandi-market.x10.mx/graphql

Include this header:

Content-Type: application/json

And in the body, send a JSON object with your GraphQL query, for example:

{
  "query": "query { products { id name inStock } }"
}

Available Queries

Get All Products

query GetProducts {
  products {
    id
    name
    inStock
    gallery
    description
    category {
      name
    }
    attributes {
      id
      name
      type
      options {
        id
        displayValue
        value
      }
    }
    prices {
      amount
      currency {
        label
        symbol
      }
    }
    brand
  }
}

Get Product by ID

query GetProductById($id: ID!) {
  product(id: $id) {
    id
    name
    inStock
    gallery
    description
    category {
      name
    }
    attributes {
      id
      name
      type
      options {
        id
        displayValue
        value
      }
    }
    prices {
      amount
      currency {
        label
        symbol
      }
    }
    brand
  }
}

Get Products by Category

query GetProductsByCategory($category: String!) {
  products(category: $category) {
    id
    name
    inStock
    gallery
    description
    category {
      name
    }
    attributes {
      id
      name
      type
      options {
        id
        displayValue
        value
      }
    }
    prices {
      amount
      formatted
      currency {
        label
        symbol
      }
    }
    brand
  }
}

Get Categories

query GetCategories {
  categories {
    name
  }
}

Get All Orders

query GetOrders {
  orders {
    id
    total
    currency
    createdAt
    items {
      productId
      quantity
      price
      attributes
    }
  }
}

Mutations

Create Order

mutation CreateOrder($input: OrderInput!) {
  createOrder(input: $input) {
    total
    currency
    items {
      productId
      quantity
      price
      attributes
    }
  }
}