---
title: "批量查询分类关系"
description: "查询商品分类关系。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/collection-relationship/get-product-collection-relationships'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/collection-relationship/get-product-collection-relationships.md'
---
# 批量查询分类关系

查询商品分类关系。

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `read_products`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
GET /products/collects.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `read_products`

## Request

### Query Parameters

* `limit`

  string (optional)

  要查询的商品分类关系的数量限制。 <br/>
  取值范围：1-250  <br/>
  默认值：50  

* `page_info`

  string (optional)

  分页查询的唯一标识，用于定位特定页面。
  
  该字段值需要在你已经查询完分页信息后，在该接口响应头中的 `link` 字段值中获取。例如，你获取到的 `link` 的值为 `<https://{handle}.myshopline.com/admin/openapi/{version}/products/collects.json?limit=1&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel="next"` ，那么 `page_info `的值为 `eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9` 。
  
  关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。

* `product_id`

  string (optional)

  商品的唯一标识 ID。<br/>
  最大长度限制：64 

* `since_id`

  string (optional)

  分类关系的 ID。传入该值后，会从指定的分类关系 ID 开始查询分类。

* `collection_id`

  string (optional)

  分类的唯一标识 ID。
  <br/>最大长度限制：64

* `fields`

  string (optional)

  指明需要返回的字段，多个字段用英文逗号分隔。可指定的字段范围参考响应体中 `collects` 对象下的一级子字段。

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `401`

  

* `429`

  

### Response Headers

* `link`

  提供分页数据的 URL 链接。你可以获取该字段值中的 `page_info` 信息用于下一次分页请求中。
  
  当你请求的页面存在上一页或下一页的时候，该字段会被返回。关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `collects`

  array<object>

  商品分类关系列表。

  * `created_at`

    string

    商品分类关系创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `id`

    long

    商品分类关系的唯一标识 ID。

  * `product_id`

    string

    商品的唯一标识 ID。

  * `product_priority`

    long

    商品在分类中的优先级，数值越小，优先级越高。优先级的数值为非连续分布，即不按连续的整数排列。

  * `sort_value`

    string

    商品排序值。由 `product_priority` 值左补足 0 至 20 位长度构成。

  * `updated_at`

    string

    商品分类关系最近一次更新的时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `collection_id`

    string

    分类的唯一标识 ID。


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "tags": [
    "批量查询分类关系"
  ],
  "description": "查询商品分类关系。",
  "externalDocs": {
    "description": "接口使用的权限点: `read_products` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "jW6haIjt",
  "parameters": [
    {
      "name": "limit",
      "in": "query",
      "description": "要查询的商品分类关系的数量限制。 <br/>\n取值范围：1-250  <br/>\n默认值：50  ",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "limit",
        "description": "要查询的商品分类关系的数量限制。 <br/>\n取值范围：1-250  <br/>\n默认值：50  ",
        "type": "string"
      },
      "examples": {
        "查询指定商品的分类关系": {
          "value": "10"
        }
      }
    },
    {
      "name": "page_info",
      "in": "query",
      "description": "分页查询的唯一标识，用于定位特定页面。\n\n该字段值需要在你已经查询完分页信息后，在该接口响应头中的 `link` 字段值中获取。例如，你获取到的 `link` 的值为 `<https://{handle}.myshopline.com/admin/openapi/{version}/products/collects.json?limit=1&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel=\"next\"` ，那么 `page_info `的值为 `eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9` 。\n\n关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "page_info",
        "description": "分页查询的唯一标识，用于定位特定页面。 该字段值需要在你已经查询完分页信息后，在该接口响应头中的 `link` 字段值中获取。例如，你获取到的 `link` 的值为 `<https://\\{handle\\}.myshopline.com/admin/openapi/\\{version\\}/products/products.json?limit=1&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel=\"next\"`，那么 `page_info` 的值为 `eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9`。  \n\n关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。",
        "type": "string"
      },
      "examples": {
        "查询指定商品的分类关系": {
          "value": ""
        }
      }
    },
    {
      "name": "product_id",
      "in": "query",
      "description": "商品的唯一标识 ID。<br/>\n最大长度限制：64 ",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "product_id",
        "description": "商品的唯一标识 ID。<br/>\n最大长度限制：64 ",
        "type": "string",
        "example": "16057039432335097907370282"
      },
      "example": "16057039432335097907370282",
      "examples": {
        "查询指定商品的分类关系": {
          "value": "16057039432335097907370282"
        }
      }
    },
    {
      "name": "since_id",
      "in": "query",
      "description": "分类关系的 ID。传入该值后，会从指定的分类关系 ID 开始查询分类。",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "since_id",
        "description": "分类关系的 ID。传入该值后，会从指定的分类关系 ID 开始查询分类。",
        "type": "string",
        "example": "6063851731392959569,6239973670640427881"
      },
      "example": "6063851731392959569,6239973670640427881",
      "examples": {
        "查询指定商品的分类关系": {
          "value": ""
        }
      }
    },
    {
      "name": "collection_id",
      "in": "query",
      "description": "分类的唯一标识 ID。\n<br/>最大长度限制：64",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "collection_id",
        "description": "分类的唯一标识 ID。\n<br/>最大长度限制：64",
        "type": "string",
        "example": "12249026592161154694000282"
      },
      "example": "12249026592161154694000282",
      "examples": {
        "查询指定商品的分类关系": {
          "value": ""
        }
      }
    },
    {
      "name": "fields",
      "in": "query",
      "description": "指明需要返回的字段，多个字段用英文逗号分隔。可指定的字段范围参考响应体中 `collects` 对象下的一级子字段。",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "fields",
        "description": "指明需要返回的字段，多个字段用英文逗号分隔。可指定的字段范围参考响应体中 `collects` 对象下的一级子字段。",
        "type": "string",
        "example": "created_at,id"
      },
      "example": "created_at,id",
      "examples": {
        "查询指定商品的分类关系": {
          "value": ""
        }
      }
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "link": {
          "description": "提供分页数据的 URL 链接。你可以获取该字段值中的 `page_info` 信息用于下一次分页请求中。\n\n当你请求的页面存在上一页或下一页的时候，该字段会被返回。关于更多如何使用分页信息，请参考 [分页机制](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/paging-mechanism.md)。",
          "example": "\\<https://{handle}.myshopline.com/admin/openapi/{version}/products/collects.json?limit=20&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJuZXh0IiwibGltaXQiOjF9>; rel='previous',<https://{handle}.myshopline.com/admin/openapi/{version}/products/collects.json?limit=20&page_info=eyJzaW5jZUlkIjoiMTYwNTc1OTAxNTM4OTA4Mjk1MjExMTI3ODgiLCJkaXJlY3Rpb24iOiJwcmUiLCJsaW1pdCI6MX0=\\>; rel='next'"
        },
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "collects": {
                "name": "collects",
                "description": "商品分类关系列表。",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "created_at": {
                      "name": "created_at",
                      "description": "商品分类关系创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                      "type": "string",
                      "example": "2025-03-06T02:20:26+08:00"
                    },
                    "id": {
                      "name": "id",
                      "description": "商品分类关系的唯一标识 ID。",
                      "type": "long",
                      "example": 5392284410644534000
                    },
                    "product_id": {
                      "name": "product_id",
                      "description": "商品的唯一标识 ID。",
                      "type": "string",
                      "example": "16057039432335097907370282"
                    },
                    "product_priority": {
                      "name": "product_priority",
                      "description": "商品在分类中的优先级，数值越小，优先级越高。优先级的数值为非连续分布，即不按连续的整数排列。",
                      "type": "long",
                      "example": 10000000000000
                    },
                    "sort_value": {
                      "name": "sort_value",
                      "description": "商品排序值。由 `product_priority` 值左补足 0 至 20 位长度构成。",
                      "type": "string",
                      "example": "00000010000000000000"
                    },
                    "updated_at": {
                      "name": "updated_at",
                      "description": "商品分类关系最近一次更新的时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                      "type": "string",
                      "example": "2025-03-06T02:20:26+08:00"
                    },
                    "collection_id": {
                      "name": "collection_id",
                      "description": "分类的唯一标识 ID。",
                      "type": "string",
                      "example": "12249026592161154694000282"
                    }
                  },
                  "example": {
                    "sort_value": "00000010000000000000",
                    "updated_at": "2025-03-06T02:20:26+08:00",
                    "collection_id": "12249026592161154694000282",
                    "created_at": "2025-03-06T02:20:26+08:00",
                    "id": 5392284410644534000,
                    "product_id": "16057039432335097907370282",
                    "product_priority": 10000000000000
                  }
                },
                "example": [
                  {
                    "product_id": "16057039432335097907370282",
                    "product_priority": 10000000000000,
                    "sort_value": "00000010000000000000",
                    "updated_at": "2025-03-06T02:20:26+08:00",
                    "collection_id": "12249026592161154694000282",
                    "created_at": "2025-03-06T02:20:26+08:00",
                    "id": 5392284410644534000
                  }
                ]
              }
            },
            "example": {
              "collects": [
                {
                  "id": 5392284410644534000,
                  "product_id": "16057039432335097907370282",
                  "product_priority": 10000000000000,
                  "sort_value": "00000010000000000000",
                  "updated_at": "2025-03-06T02:20:26+08:00",
                  "collection_id": "12249026592161154694000282",
                  "created_at": "2025-03-06T02:20:26+08:00"
                }
              ]
            }
          },
          "examples": {
            "查询指定商品的分类关系": {
              "description": "查询指定商品的分类关系。",
              "value": {
                "collects": [
                  {
                    "id": 5704474910564819000,
                    "product_id": "16057039432335097907370282",
                    "product_priority": 10000000000000,
                    "sort_value": "00000010000000000000",
                    "updated_at": "2022-12-06T23:45:02+08:00",
                    "collection_id": "12249026592161154694000282",
                    "created_at": "2022-12-06T23:41:49+08:00"
                  },
                  {
                    "collection_id": "12249521251322718219170282",
                    "created_at": "2022-12-06T23:45:08+08:00",
                    "id": 5704478249750898000,
                    "product_id": "16057039432335097907370282",
                    "product_priority": 10000000000000,
                    "sort_value": "00000010000000000000",
                    "updated_at": "2022-12-06T23:45:08+08:00"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "get",
  "path": "/products/collects.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "批量查询分类关系",
    "version": "v20270301"
  },
  "authIndexes": [
    "read_products"
  ]
}
```