Get Product SKU Interface

Retrieve detailed information about the SKU (Stock Keeping Unit) of a specified product, including specifications, price, stock, wholesale rules, and other related details.This interface is suitable for scenarios where product specifications and purchase options need to be displayed.

Precautions

  • Interface supports retrieval of product SKU information through product ID or URL alias (filename)
  • This interface is a product interface, suitable for product type documents
  • The returned data includes the complete specifications and SKU list of the product
  • If the product does not exist, the interface will return an error code

Request address

{域名地址}/api/archive/sku

Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/archive/sku

Request syntax

GET {域名地址}/api/archive/sku?{参数}

Request header

This interface only involves public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request Parameters

Field Name Type Required Description
id integer Yes Document ID, if filename is provided, ID is not required
filename string No Document URL alias, either document ID or filename is optional

Response Headers

This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field Name Type Description
code integer Error code
message string Error Description
data object Result Content

data Parameter

Field Name Type Description
id integer Product ID
Title string Product Title
Currency string Currency Name
Currency Symbol string Currency Symbol
Price Float Product Price
min_price Float Product Minimum Price
max_price Float Product Maximum Price
user_limit integer User purchase limit
Quota used integer Purchased quantity by user
Order count integer Sales
Stock integer Quantity of inventory
Options object[] Product specification attribute name
skus object[] Product SKU information
wholesale_rules object[] Product wholesale rules
Option product specification attribute name
Field Name Type Description
id integer Property ID
Title string Property Name
Values object[] Property Value List
Property Value
Field Name Type Description
id integer Category ID
option_id integer Attribute ID
option_title string Property Name
Title string Attribute value name
color string color value
Price Float price
product SKU information
Field Name Type Description
id integer Category ID
Title string SKU name
symbol string specification attribute value id link symbol
Values object[] Property Value List
sku string sku link symbol
barcode string Bar Code
HS Code string Customs Code
Logo string Logo
Thumbnail string Thumbnail
Stock integer Quantity of inventory
Price integer price
Original Price integer Original Price
weight integer Weight
Weight Unit string Unit of Weight
sold_count integer Sales
Wholesale Rules Product Wholesale Rules
Field Name Type Description
id integer Rule ID
archive_id integer Document ID
min_quantity integer minimum quantity
max_quantity integer maximum quantity
sku_id integer SKU ID
discount_rate integer discount_rate, 0-100
created_time integer Creation time
updated_time integer Update time

Example Usage

Request Example

GET /api/archive/sku?id=1 HTTP/1.1
Host: your-domain.com
Content-Type: application/json

or

GET /api/archive/sku?filename=product-slug HTTP/1.1
Host: your-domain.com
Content-Type: application/json

Response Example

{
  "code": 0,
  "data": {
    "id": 1,
    "title": "示例产品",
    "currency": "人民币",
    "currency_symbol": "¥",
    "price": 100.00,
    "min_price": 80.00,
    "max_price": 120.00,
    "user_limit": 10,
    "quota_used": 2,
    "order_count": 100,
    "stock": 998,
    "options": [
      {
        "id": 1,
        "title": "颜色",
        "values": [
          {
            "id": 1,
            "option_id": 1,
            "option_title": "颜色",
            "title": "红色",
            "color": "#FF0000",
            "price": 100.00
          },
          {
            "id": 2,
            "option_id": 1,
            "option_title": "颜色",
            "title": "蓝色",
            "color": "#0000FF",
            "price": 100.00
          }
        ]
      },
      {
        "id": 2,
        "title": "尺寸",
        "values": [
          {
            "id": 3,
            "option_id": 2,
            "option_title": "尺寸",
            "title": "大号",
            "color": "",
            "price": 100.00
          },
          {
            "id": 4,
            "option_id": 2,
            "option_title": "尺寸",
            "title": "小号",
            "color": "",
            "price": 100.00
          }
        ]
      }
    ],
    "skus": [
      {
        "id": 1,
        "title": "红色-大号",
        "symbol": "1-3",
        "values": [
          {
            "id": 1,
            "option_id": 1,
            "option_title": "颜色",
            "title": "红色",
            "color": "#FF0000",
            "price": 100.00
          },
          {
            "id": 3,
            "option_id": 2,
            "option_title": "尺寸",
            "title": "大号",
            "color": "",
            "price": 100.00
          }
        ],
        "sku": "SKU001",
        "barcode": "123456789",
        "hs_code": "",
        "logo": "",
        "thumb": "",
        "stock": 100,
        "price": 10000,
        "origin_price": 12000,
        "weight": 100,
        "weight_unit": "g",
        "sold_count": 50
      }
    ],
    "wholesale_rules": [
      {
        "id": 1,
        "archive_id": 1,
        "min_quantity": 1,
        "max_quantity": 10,
        "sku_id": 1,
        "discount_rate": 90,
        "created_time": 1630000000,
        "updated_time": 1630000000
      }
    ]
  },
  "msg": ""
}

Error Code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Unauthorized
200 API request OK