开放 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
Blog
Blog
Blog 是博客对象,通过它可以读取博客内容,或者执行博客的创建、更新、删除。
友好速搭提供的是轻博客功能,Blog 分为:文字、音乐、图片、视频四种。目前,Blog 的开放 API,仅支持文字类型的博客。
Blog 对象支持 Webhook 和 Metafields 。
Blog 相关API
Blog 属性
- id
Number 类型,Blog 的唯一整型标识。{ "id": 326 }
- title
String 类型,Blog 的标题。{ "title" : "欢迎使用友好速搭" }
- blog_author
- Object 类型,作者笔名,参考 blog_author 对象
- content
String 类型,博客内容。{ "content" : "博客内容" }
- content_capture
String 类型,博客内容摘要。{ "content" : "博客内容摘要" }
- handle
Handle 类型,Blog 的自定义标识。{ "handle" : "my-first-handle" }
- view_type
Number 类型,Blog 的显示状态:0-全部可见;1-仅登录用户可见;2-仅管理员可见。{ "view_type" : 1 }
- page_description
String 类型,Blog 的网页描述,主要用于 SEO 优化。{ "page_description" : "网页描述" }
- page_keywords
String 类型,Blog 的网页关键词,主要用于 SEO 优化。{ "page_keywords" : "网页关键词" }
- page_title
String 类型,Blog 的网页标题,主要用于 SEO 优化。{ "page_title" : "网页标题" }
- share_title
String 类型,社交优化标题。{ "share_title": "社交优化标题" }
- share_description
String 类型,社交优化描述。{ "share_description": "社交优化描述" }
- share_image_id
Integer 类型,社交图片id。{ "share_image_id": 1024 }
- created_at
Datetime 类型,Blog 的创建时间。{ "created_at": "2015-01-25T22:31:06.155+08:00" }
- updated_at
Datetime 类型,Blog 的最近一次修改时间。{ "updated_at": "2015-01-25T22:31:06.155+08:00" }
- post_at
Datetime 类型,Blog 的发布时间。{ "post_at": "2015-01-25T22:31:06.155+08:00" }
- tags
Array 类型,Blog 的标签。{ "tags": ["test"] }
GET /blogs
获取 Blog 列表
- tag
- 模糊查询指定标签
- limit
- 显示条数(默认10,最大50)
- page
- 显示页码(默认1)
- since_id
- 筛选
id
大于since_id
的 Blog
- fields
- 以
,
拼接需要获取的字段
- id
- 查询指定
id
- ids
- 以
,
拼接要显示的id
范围
- created_at_min
- 缺省筛选创建时间在指定日期时间之后的 Blog(格式2014-09-01T01:00:01)
- created_at_max
- 缺省筛选创建时间在指定日期时间之前的 Blog(格式2014-09-01T01:00:01)
- updated_at_min
- 缺省筛选更新时间在指定日期时间之后的 Blog(格式2014-09-01T01:00:01)
- updated_at_max
- 缺省筛选更新时间在指定日期时间之前的 Blog(格式2014-09-01T01:00:01)
- 获取 Blog 列表
- GET /blogs
{ "blogs": [ { "blog_author": { "avatar": { "id": 249, "asset_id": "54fc12b54812f22a6800000b", "file_name": "QQ截图20140327131522.png", "epoch": "1425806020", "src": "/image/54fc12b54812f22a6800000b/QQ截图20140327131522.png?1425806020" }, "created_at": "2015-03-08T17:13:40.943+08:00", "douban_url": "", "id": 119, "name": "LavandaChen", "renren_url": "", "updated_at": "2015-03-08T17:13:40.943+08:00", "weibo_url": "", "weixin_name": "", "weixin_qc_code": null }, "content": "非常好看,而且看多少个版本都会觉得好。因为:<br /><br />1、本土化之后比国外的版本更好一些,因为感同身受的感觉更强烈;<br />2、这种类型的案件发生时间越靠近观众所处的时间观众理解就会越深,所反映的社会问题也就越会被观众所理解。<br />所以从这两个意义上这类电影或戏剧是常做常新的。", "content_capture": "非常好看,而且看多少个版本都会觉得好。因为:1、本土化之后比国外的版本更好一些,因为感同身受的感觉更强烈;2、这种类型的案件发生时间越靠近观众所处的时间观众理解就会越深,所反映的社会问题也就越会被观众所理解。所以从这两个意义上这类电影或戏剧是常做常新的。", "created_at": "2015-10-07T13:19:36.680+08:00", "handle": "b000010", "id": 1915, "page_description": "", "page_keywords": "", "share_description": "", "share_title": "", "page_title": "十二怒汉", "post_at": "2015-10-07T13:20:56.134+08:00", "tags": [ "电影" ], "title": "十二怒汉", "updated_at": "2016-01-07T01:48:21.873+08:00", "view_type": 0 } }
GET /blogs/count
获取 Blog 数量
- 获取 Blog 数量
- GET /blogs/count
{ "count": 2 }
GET /blogs/#{id}
获取单个 Blog
- fields
- 以
,
拼接要指定返回的字段
- 获取单个 Blog
- GET /blogs/#{id}
{ "blog": { "blog_author": { "avatar": { "id": 249, "asset_id": "54fc12b54812f22a6800000b", "file_name": "QQ截图20140327131522.png", "epoch": "1425806020", "src": "/image/54fc12b54812f22a6800000b/QQ截图20140327131522.png?1425806020" }, "created_at": "2015-03-08T17:13:40.943+08:00", "douban_url": "", "id": 119, "name": "LavandaChen", "renren_url": "", "updated_at": "2015-03-08T17:13:40.943+08:00", "weibo_url": "", "weixin_name": "", "weixin_qc_code": null }, "content": "test11", "content_capture": "test11", "created_at": "2015-12-17T20:36:49.366+08:00", "handle": "b000014", "id": 2641, "page_description": "", "page_keywords": "", "page_title": "test", "share_description": "", "share_title": "", "post_at": "2015-12-17T20:37:00.223+08:00", "tags": [ "test" ], "title": "test", "updated_at": "2016-01-06T23:21:28.120+08:00", "view_type": 2 } }
POST /blogs
创建 Blog
- 创建 Blog
- POST /blogs
{ "blog": { "blog_author": { "id": 119 }, "content": "<p>test </p>", "content_capture": "test11", "page_description": "", "page_keywords": "", "page_title": "", "share_description": "", "share_title": "", "post_at": "2014-11-25T20:09:00.438+08:00", "title": "1112", "view_type": 2, "tags":["test1","1","2","1"] } }
{ "blog": { "blog_author": { "avatar": { "id": 249, "asset_id": "54fc12b54812f22a6800000b", "file_name": "QQ截图20140327131522.png", "epoch": "1425806020", "src": "/image/54fc12b54812f22a6800000b/QQ截图20140327131522.png?1425806020" }, "created_at": "2015-03-08T17:13:40.943+08:00", "douban_url": "", "id": 119, "name": "LavandaChen", "renren_url": "", "updated_at": "2015-03-08T17:13:40.943+08:00", "weibo_url": "", "weixin_name": "", "weixin_qc_code": null }, "content": "<p>test </p>", "content_capture": "test11", "created_at": "2016-01-07T02:27:00.315+08:00", "handle": "b000021", "id": 3009, "page_description": "", "page_keywords": "", "share_description": "", "share_title": "", "page_title": "", "post_at": "2014-11-25T20:09:00.438+08:00", "tags": [ "1", "2", "test1" ], "title": "1112", "updated_at": "2016-01-07T02:27:00.315+08:00", "view_type": 0 } }
PUT /blogs/#{id}
更新 Blog
- 更新 Blog
- PUT /blogs/3009
{ "blog": { "title": "新标题", "content": "<p>test </p>" } }
{ "blog": { "blog_author": { "avatar": { "id": 249, "asset_id": "54fc12b54812f22a6800000b", "file_name": "QQ截图20140327131522.png", "epoch": "1425806020", "src": "/image/54fc12b54812f22a6800000b/QQ截图20140327131522.png?1425806020" }, "created_at": "2015-03-08T17:13:40.943+08:00", "douban_url": "", "id": 119, "name": "LavandaChen", "renren_url": "", "updated_at": "2015-03-08T17:13:40.943+08:00", "weibo_url": "", "weixin_name": "", "weixin_qc_code": null }, "content": "<p>test </p>", "content_capture": "test11", "created_at": "2016-01-07T02:27:00.315+08:00", "handle": "b000021", "id": 3009, "page_description": "", "page_keywords": "", "share_description": "", "share_title": "", "page_title": "", "post_at": "2014-11-25T20:09:00.438+08:00", "tags": [ "1", "2", "test1" ], "title": "新标题", "updated_at": "2016-01-07T02:27:00.315+08:00", "view_type": 0 } }
DELETE /blogs/#{id}
删除 Blog
- 删除 Blog
- DELETE /blogs/3009
{}
POST /blogs/#{id}/upload_base64_share
上传指定博客的社交分享图片,id为对应博客的id。
- file_name
- 上传图片的名称
- attachment
- 经过base64编码的图片
- 创建 share image
- POST /blogs/4008/upload_base64_share
{ "share_image": { "file_name":"s.jpg", "attachment": "data:image/gif;base64,R0lGODlhAQABAID/AP///wAAACwAAAAAAQABAAACAkQBADs=" } }
{ "share_image": { "epoch": "1463994523", "height": 150, "id":788, "image_id":"57406f4080ea3e74b8000002", "src":"/image/57406f4080ea3e74b8000002/s.jpg?1463994523", "width": 228 } }
DELETE /blogs/#{id}/remove_share
删除指定博客的社交分享图片,id为博客id。
- 删除ID为4008的博客的社交分享图片。
- DELETE /blogs/4008/remove_share
{}