开放 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
ProductImage
ProductImage
ProductImage 为 Product 的橱窗图片,用于商品列表和商品详情页面呈现,一个 Product 可以包含多个 ProductImage。
ProductImage 相关API
ProductImage 属性
- id
Number 类型,ProductImage 唯一整型标识。{ "id" : 148002 }
- product_id
Number 类型,ProductImage 所属 Product 的唯一整型标识。{ "product_id" : 10254}
- created_at
Datetime 类型,ProductImage 的创建时间。{ "created_at" : "2014-02-15T15:12:21+08:00" }
- updated_at
Datetime 类型,ProductImage 的上一次更新时间。{ "updated_at" : "2014-02-15T15:12:21+08:00" }
- file_name
String 类型,ProductImage 的文件名。{ "file_name" : "商品图片-10023.png" }
- src
String 类型,ProductImage 的访问路径。{ "src" : "http://asset.ibanquan.com/image/55111114e13823461a000005/s.png?v=1427181844" }
- position
Number 类型,ProductImage 在商品橱窗图片中显示的位置排序。{ "position" : 2}
- variant_ids
Array 类型,ProductImage 被关联的 ProductVariant。{ "variant_ids" : [963] }
GET /products/#{id}/images
获取 Product 所有 ProductImage
- fields
- 需要查询的字段
- 获取 Product 所有 ProductImage
- GET /products/12032/images
{ "images": [ { "alt": "", "created_at": "2015-03-24T15:24:04.267+08:00", "file_name": "商品图片1.png", "id": 155870, "position": 2, "product_id": 12032, "src": "http://asset.ibanquan.com/image/55111114e13823461a000005/s.png?v=1427181844", "updated_at": "2015-03-24T15:24:04.267+08:00", "variant_ids": [] }, { "alt": "", "created_at": "2015-03-24T15:24:07.792+08:00", "file_name": "商品图片2.jpg", "id": 155871, "position": 1, "product_id": 12032, "src": "http://asset.ibanquan.com/image/55111117e138230b0a000006/s.jpg?v=1427181847", "updated_at": "2015-03-24T15:24:07.792+08:00", "variant_ids": [963] } ] }
GET /products/#{id}/images/count
获取 Product 所有 ProductImage 的数量
- 获取商品所有 ProductImage 的数量
- GET /products/12032/images/count
{ "count": 2 }
GET /products/#{id}/images/#{id}
获取 Product 的单个 ProductImage
- fields
- 需要查询的字段
- 获取 Product 的单个 ProductImage
- GET /products/12032/images/155871
{ "image":{ "alt": "", "created_at": "2015-03-24T15:24:07.792+08:00", "file_name": "商品图片2.jpg", "id": 155871, "position": 1, "product_id": 12032, "src": "http://asset.ibanquan.com/image/55111117e138230b0a000006/s.jpg?v=1427181847", "updated_at": "2015-03-24T15:24:07.792+08:00", "variant_ids": [963] } }
POST /products/#{id}/images
创建 ProductImage
- image[attachment]
- 图片的 base64 数据
- image[file_name]
- 图片文件名
- 创建 ProductImage
- POST /products/12560/images
{ "image": { "file_name": "商品图片-10098.jpg", "attachment": "data:image/gif;base64,R0lGODlhAQABAID/AP///wAAACwAAAAAAQABAAACAkQBADs=" } }
{ "image": { "alt": "", "created_at": "2015-03-24T16:53:58.337+08:00", "file_name": "商品图片-10098.jpg", "id": 156896, "position": 3, "product_id": 12560, "src": "http://asset.ibanquan.com/image/551126266387e479ae000002/s.jpg?1427187238", "updated_at": "2015-03-24T16:53:58.337+08:00", "variant_ids": [] } }
PUT /products/#{id}/images/#{id}
更新 ProductImage
- image[alt]
- 图片的 alt 属性
- image[file_name]
- 图片文件名
- 更新 ProductImage
- PUT /products/12560/images/156896
{ "image": { "alt": "自定义描述", "file_name": "商品图片-98.jpg" } }
{ "image": { "alt": "自定义描述", "created_at": "2015-03-24T16:53:58.337+08:00", "file_name": "商品图片-98.jpg", "id": 156896, "position": 3, "product_id": 12560, "src": "http://asset.ibanquan.com/image/551126266387e479ae000002/s.jpg?1427187238", "updated_at": "2015-03-24T16:53:58.337+08:00", "variant_ids": [] } }
DELETE /products/#{id}/images/#{id}
删除 ProductImage
- 删除 ProductImage
- DELETE /products/12560/images/156896
{}
以上内容仍未解决您的问题?
联系在线客服