GraphQL API reference

View the reference document to learn about the data types available in the GraphQL API architecture.

Guide

quick start

The GraphQL API provides a unified data access interface, supporting queries (Queries), mutations (Mutations), and object type definitions.This system covers a variety of functions including content management, user information, product data, and comment systems.

query operations (Queries)

Query operations are used to retrieve data from the server, supporting rich parameter options and flexible data filtering.

content management query

  • archive- Obtain details of a single document or product, supporting ID, URL alias, password verification, and other methods for locating content
  • archives- Get document list, supporting pagination, filtering, sorting, search, and other functions
  • archiveParams- Get custom fields of documents, convenient for handling extended information
  • page/Pages- Get single page details or list
  • category/Categories- Get category details or list
  • tag/tags- Get tag details or list

System configuration query

  • system- Get system settings information
  • contact- Get contact information
  • currency- Get currency information
  • Index- Get home page TDK information
  • languages- Get multilingual site information

User interaction query

  • user- Get user information
  • comments- Get Comment List
  • Reviews- Get Product Review List
  • metadata- Get Page Meta Information

Navigation and Display Query

  • navs- Get Navigation List
  • banners- Get the homepage carousel
  • friendLinks- Get the friend link
  • Filters- Get the filtering field

Change operation (Mutations)

The change operation is used to modify server data.

Review Management

  • create review- Create product review, supporting rating, content, pictures and other review information

Object type (Objects)

Object type defines the data structure returned by the API, including the following main types:

Content-related objects

  • Archive- Document details, including articles and product information
  • Archive List- Document list
  • Category- Classification information
  • Tag- Tag Information
  • Page- Single Page Information

User-related objects

  • User- User Information
  • UserGroup- User Group Information
  • UserGroupSetting- User Group Settings

Product-related objects

  • Sku- Product SKU Information
  • ArchiveSku- Product Specification SKU Information
  • Archive option- Product Specification Options
  • WholesaleRule- Wholesale Rules

Interactive related object

  • Comment- Comment Information
  • Comment list- Comment List
  • Review- Product Review
  • Review List- Product Review List

System Related Objects

  • SystemSetting- System Settings
  • Contact Setting- Contact Information
  • Currency Setting- Currency Settings
  • IndexSetting- Home Page TDK Settings

Scalar Type (Scalars)

Basic Data Types:

  • String- text data
  • Integer- integer value
  • Float- floating-point value
  • Boolean- boolean value
  • JSON- JSON data structure
  • ID- Unique Identifier

Common Query Example

Get article details

query GetArticle {
  archive(id: 1, render: true) {
    id
    title
    content
    description
    category {
      name
    }
    tags {
      name
    }
    views
    created_time
  }
}

Get article list

query GetArticles {
  archives(limit: 10, page: 1, category_id: 1) {
    items {
      id
      title
      description
      thumb
      created_time
    }
    page
    total
  }
}

Get Categories and Articles

query GetCategoryWithArticles {
  category(id: 1) {
    id
    title
    description
    archives(limit: 5) {
      items {
        id
        title
        description
      }
      total
    }
  }
}

Create Review

mutation CreateReview {
  createReview(
    content: "很好的产品!"
    score: 5
    user_name: "用户名"
    email: "[email protected]"
  ) {
    id
    content
    score
    user_name
    created_time
  }
}