TDK API 对接指引

一、背景

为了满足 SEO 类型插件接入,需提供通过搜索引擎优化功能快速更新 TDK 的能力,在以下范围内开放相关能力:

1. 页面范围:分类页、商品页、博客文章、博客集合页、自定义页面

2. 接口类型:新增、更新

3. 字段及功能:

  • Title:修改页面标题

  • Description:调整页面 Meta Description

  • Keywords:调整页面 Meta Keywords

二、对接方式

1. 接口文档

  • 查询资源下的元字段

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/shopline-metafields/metafields/resource-metafields/get-metafields-for-a-resource?version=v20251201

  • 通过元字段进行创建/更新

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/shopline-metafields/metafields/resource-metafields/operate-metafields-in-bulk?version=v20251201

2. 字段说明

  • namespace :seo 保持不变即可

  • type :single_line_text_field 保持不变即可

  • key:

    • seoTitle 对应 SEO 中的 Title

    • seoDescription 对应 SEO 中的 Description

    • seoKeyword 对应 SEO 中的 Keywords

  • owner_resource: 所属资源类型

    • products:商品

    • collections:商品分类

    • pages:页面

    • blogs:博客集合

    • articles:博客

  • owner_id: 资源的 id,如 products 类型的资源 id 为对应商品的 id

  • value:具体的值

{
  "metafields": [
    {
      "value": "seoTitle",
      "owner_id": "16070648133130251501392795",
      "owner_resource": "products",
      "type": "single_line_text_field",
      "namespace": "seo",
      "key": "seoTitle"
    },
    {
      "value": "seoDescription",
      "owner_id": "16070648133130251501392795",
      "owner_resource": "products",
      "type": "single_line_text_field",
      "namespace": "seo",
      "key": "seoDescription"
    },
    {
      "value": "seoKeyword,seoKeyword1,seoKeyword2,seoKeyword3",
      "owner_id": "16070648133130251501392795",
      "owner_resource": "products",
      "type": "single_line_text_field",
      "namespace": "seo",
      "key": "seoKeyword"
    }
  ]
}

3. 资源 id 获取

a. 商品

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/product/get-products?version=v20251201

b. 分类
  • 手动分类

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/collection/batch-query-manual-collection?version=v20251201

  • 智能分类

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/collection/batch-query-intelligent-collection?version=v20251201

c. 自定义页面

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/page/query-page-s-detail-information/

d. 博客集合

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/blog-collection/query-blog-collection-list?version=v20251201

e. 博客

https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/blog-post/query-blog-post-list?version=v20251201