开放 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
CustomerAddress
CustomerAddress
顾客配送地址。每个 Customer 账号,可以设置多个 CustomerAddress。
一个 CustomerAddress 由以下两部分组成:
CustomerAddress 属性
- id
Number 类型,CustomerAddress 唯一整型标识。{ "id" : 2 }
- country
String 类型,国家名称。{ "country" : "中国" }
- country_code
String 类型,国家简称。{ "country_code" : "CN" }
- province
String 类型,省份名称。{ "province" : "北京市" }
- province_code
String 类型,省份编码。{ "province_code" : "110000" }
- city
String 类型,城市名称。{ "city" : "市辖区" }
- city_code
String 类型,城市编码。{ "city_code" : "110100" }
- district
String 类型,行政区名称。{"district": "西城区"}
- district_code
String 类型,行政区编码。{"district_code": "110102"}
- detail
String 类型,详细地址。{"detail": "清华大学17号楼305"}
- zipcode
String 类型,邮政编码。{"zipcode": "" }
- name
String 类型,收件人姓名。{"name": "刁宜成" }
- mobile
String 类型,收件人手机号码。{"mobile": "13632269358" }
String 类型,收件人邮箱。{"email": "some@sample.com" }
- telephone
String 类型,收件人固定电话。{"telephone": "010-25468112" }
- is_default
Bool 类型,是否账号指定的默认送货地址。{"is_default": false }
- created_at
Datetime 类型,地址创建时间。{ "created_at" : "2015-03-12T15:35:12.242+08:00" }
- updated_at
Datetime 类型,地址上次更新时间。{ "updated_at" : "2015-03-12T16:18:21.602+08:00" }
CustomerAddress 相关API
GET /customers/#{id}/addresses
获取指定 ID 的账号,用过的所有配送地址
- 获取 ID 为 595 的账号,使用的所有配送地址
- GET /customers/595/addresses
{ "addresses": [ { "city": "市辖区", "city_code": "110100", "completed_address": "中国,北京市,市辖区,西城区,11111111111", "country": "中国", "country_code": "CN", "created_at": "2014-12-07T11:09:07.067+08:00", "detail": "11111111111", "district": "西城区", "district_code": "110102", "email": "", "id": 520, "is_default": false, "mobile": "13632269380", "name": "11", "province": "北京市", "province_code": "110000", "telephone": "", "updated_at": "2014-12-07T11:09:07.067+08:00", "zipcode": null } ] }
GET /customers/#{id}/addresses/count
获取指定 ID 的账号,使用的配送地址总数
- 获取ID为595的账号,使用的配送地址总数
- GET /customers/595/addresses/count
{ "count": 1 }
GET /customers/#{id}/addresses/#{address_id}
获取账号,指定 ID 的配送地址详情
- 获取 ID 为 595 的账号,地址 ID 为 520 的配送地址详情
- GET /customers/595/addresses/520
{ "address": { "city": "市辖区", "city_code": "110100", "completed_address": "中国,北京市,市辖区,西城区,11111111111", "country": "中国", "country_code": "CN", "created_at": "2014-12-07T11:09:07.067+08:00", "detail": "11111111111", "district": "西城区", "district_code": "110102", "email": "", "id": 520, "is_default": false, "mobile": "13632269380", "name": "11", "province": "北京市", "province_code": "110000", "telephone": "", "updated_at": "2014-12-07T11:09:07.067+08:00", "zipcode": null } }
POST /customers/#{id}/addresses
为指定账号,创建新的配送地址
- name
- 必须,收件人姓名
- mobile
- 必须,收件人手机号码
- district_code
- 必须,行政区编号
- detail
- 必须,详细地址
- zipcode
- 可选,邮政编码
- telephone
- 可选,收件人固定电话
- 可选,收件人邮箱
- is_default
- 可选,是否设置为默认配送地址
- 为 ID 为 595 的账号,创建新的收件地址
- POST /customers/595/addresses
{ "address":{ "name":"wwww", "detail":"wwww", "district_code":"110102", "mobile":"136322" } }
{ "address": { "city": "市辖区", "city_code": "110100", "completed_address": "中国,北京市,市辖区,西城区,wwww", "country": "中国", "country_code": "CN", "created_at": "2015-04-28T22:08:08.898+08:00", "detail": "wwww", "district": "西城区", "district_code": "110102", "email": "", "id": 1587, "is_default": false, "mobile": "136322", "name": "wwww", "province": "北京市", "province_code": "110000", "telephone": "", "updated_at": "2015-04-28T22:08:08.898+08:00", "zipcode": null } }
PUT /customers/#{id}/addresses/#{address_id}
更改指定的配送地址
- 获取 ID 为 595 的账号,更改地址 ID 为 1587 的配送地址
- PUT /customers/595/addresses/1587
{ "address":{ "name":"姓名", "detail":"地址" } }
{ "address": { "city": "市辖区", "city_code": "110100", "completed_address": "中国,北京市,市辖区,西城区,地址", "country": "中国", "country_code": "CN", "created_at": "2015-04-28T22:08:08.898+08:00", "detail": "地址", "district": "西城区", "district_code": "110102", "email": "", "id": 1587, "is_default": false, "mobile": "136322", "name": "姓名", "province": "北京市", "province_code": "110000", "telephone": "", "updated_at": "2015-04-28T22:17:50.063+08:00", "zipcode": null } }
DELETE /customers/#{id}/addresses/#{address_id}
删除指定账号的指定配送地址
- 在 ID 为 595 的账号中,删除配送地址 ID 为 520 的地址
- DELETE /customers/595/addresses/520
{}