开放 API
使用说明
获取授权
全部 API
- Shop
- Metafields
- Customer
- CustomerAddress
- Account
- Product
- ProductVariant
- ProductImage
- Theme
- Asset
- Country
- Province
- City
- District
- ScriptTag
- Order
- Shipment
- ShipmentSupplier
- Payment
- PaymentMethod
- Redirect
- Page
- Webhook
- Blog
- BlogAuthor
- CustomerLevel
- StoreFile
- Promotion
- Coupon
- Post
- AfterSale
Post
Post
Post 为网站的文章信息
Post 相关API
Post 属性
- id
Integer 类型,文章的唯一整型标识。{ "id": 1234 }
- handle
String 类型,文章的自定义标识。{ "handle" : "x000006" }
- title
String 类型,文章的标题。{ "title" : "ABCD"}
- summary
String 类型,文章的简介。{ "summary" : "简介内容AAA"}
- publish_at
Datetime 类型,文章的发布时间。{ "publish_at" : "2015-01-25T22:31:06.155+08:00"}
- page_title
String 类型,文章的分享标题。{ "page_title" : "T234" }
- page_keywords
String 类型,文章的网页关键词。{ "page_keywords" : "关关" }
- created_at
Datetime 类型,文章的创建时间。{ "created_at" : "2015-01-25T22:31:06.155+08:00" }
- updated_at
Datetime 类型,文章的更新时间。{ "updated_at" : "2015-01-25T22:31:06.155+08:00" }
- page_description
String 类型,文章的网页/分享描述。{ "page_description" : "喵喵蜀黍" }
- content
String 类型,文章的内容。{ "content" : "文章内容" }
- tags
Array 类型,文章的标签。{ "tags" : ["a", "b"] }
- dirs
Array 类型,文章的目录。{ "dirs" : ["目录1", "目录2"] }
- share_image
- Object 类型,文章的分享头图。
- cover_image
- Object 类型,文章的封面图。
GET /posts
获取文章列表
- limit
- 显示条数(默认10,最大50)
- page
- 显示页码(默认1)
- since_id
- 筛选
id
大于since_id
的Order
- fields
- 以
,
拼接Response显示的字段
- title
- 查询文章的标题,使用模糊匹配
- tag
- 查询文章的标签,使用模糊匹配
- dir
- 查询文章的目录,使用模糊匹配
- id
- 查询指定
id
- ids
- 以
,
拼接要显示的id
范围
- 获取文章列表
- GET /posts
HTTP/1.1 200 OK
{ "posts": [ { "content": "<p>文章内容</p>", "cover_image":{"epoch": "1502704947", "height": 900, "id": 2008, "image_id": "59917530fc165b32d3000002",…}, "created_at": "2017-08-01T17:31:24.680+08:00", "dirs":[["未2" ], ["未分类目录" ]], "handle": "x000006", "id": 1220, "page_description": "描述描述", "page_keywords": "关键关键", "page_title": "标题标题", "publish_at": "2017-08-01T17:31:49.432+08:00", "share_image": null, "summary": "简介哟", "tags":["a", "b"], "title": "思来想去", "updated_at": "2017-08-15T16:34:35.499+08:00" } ] }
GET /posts/:id
获取单篇文章的信息
- 获取单篇文章信息
- GET /posts/1220
HTTP/1.1 200 OK
{ "post": { "content": "<p>文章内容</p>", "cover_image":{"epoch": "1502704947", "height": 900, "id": 2008, "image_id": "59917530fc165b32d3000002",…}, "created_at": "2017-08-01T17:31:24.680+08:00", "dirs":[["未2" ], ["未分类目录" ]], "handle": "x000006", "id": 1220, "page_description": "描述描述", "page_keywords": "关键关键", "page_title": "标题标题", "publish_at": "2017-08-01T17:31:49.432+08:00", "share_image": null, "summary": "简介哟", "tags":["a", "b"], "title": "思来想去", "updated_at": "2017-08-15T16:34:35.499+08:00" } }
GET /posts/tags
所有的文章标签
- 所有的文章标签
- GET /posts/tags
- HTTP/1.1 200 OK
{ "tags":[ { "id": 185, "name": "a" }, { "id": 186, "name": "b" } ] }
GET /posts/tags/:id
单个的文章标签
- 单个文章标签的信息
- GET /posts/tags/185
- HTTP/1.1 200 OK
{ "tag":{ "id": 185, "name": "a" } }
GET /posts/dirs
所有的文章目录
- 所有的文章目录
- GET /posts/dirs
- HTTP/1.1 200 OK
{ "dirs":[ { "id": 1656, "name": "未分类目录", "parent_dir_id": 1653, "post_count": 0 }, { "id": 1655, "name": "未分", "parent_dir_id": 1653, "post_count": 0 } ] }
GET /posts/dirs/:id
单个文章目录
- 单个文章目录
- GET /posts/dirs/1656
- HTTP/1.1 200 OK
{ "dirs":{ "id": 1656, "name": "未分类目录", "parent_dir_id": 1653, "post_count": 0 } }
POST /posts/
创建文章
- handle
- 文章的访问路径
- title
- 文章标题
- content
- 文章内容
- publish_at
- 发布时间
- page_title
- seo title信息
- page_keywords
- seo 关键字
- page_description
- seo 描述信息
- visibility
- 文章是否发布 true / false
- share_image_id
- 分享头图id
- cover_image_id
- 封面图片id
- tags
- 标签名,array类型,可以传递多个,若无当前标签,则会进行创建
- dirs
- 文章所在目录,array类型,同tags
- 创建文章
- POST /posts/
{ "post":{ "title":"测试", "content":"测试内容", "tags":["测试标签", "测试标签2"], "dirs":["测试目录1", "测试目录2"] } }
- HTTP/1.1 200 OK
{ "post": { "content": "测试内容", "cover_image": null, "created_at": "2019-06-30T11:22:26.520+08:00", "dirs": [ "测试目录1", "测试目录2" ], "handle": "x000049", "id": 1852, "page_description": "", "page_keywords": "", "page_title": "", "publish_at": "2019-06-30T11:22:26.520+08:00", "share_image": null, "summary": null, "tags": [ "测试标签", "测试标签2" ], "title": "测试", "updated_at": "2019-06-30T11:22:26.520+08:00" } }
以上内容仍未解决您的问题?
联系在线客服