OzBabies提供相应API帮助内部客人建立订单。API基于JSON Restful结构,请联系网站管理员获取API权限账户。
API endpoint列表:
- Get secure CSRF token - 获取CSRF token用于加强网站API连接安全
- Get Products List - 获取当前商品列表
- Get Logistic Provider List - 获取可用物流列表
- Get User Store Credit - 获取用户网站credit
- Create OzBabies Order - 建立订单
API 连接 authentication:
方式 - Basic Auth (Pass via HTTP header)
参数 - Username, Password (Account credential from ozbabies.com.au)
获取 secure CSRF token:
哈希字符串用于传入建立订单API
Method | GET |
---|---|
URL | <domain.com>/rest/session/token |
Header | N/A |
Parameter | N/A |
Format | JSON |
---|---|
Return | Error: {"message":"----"} 404 - API resource not found Success: 200 - <token> - String |
Get Products List:
拿取当前商品列表
Method | GET |
---|---|
Url | <domain.com>/api/v1/product_lists?_format=json |
Header | [ "Content-Type": "application/json" ] |
Parameter | N/A |
Example | GET /api/v1/product_lists?_format=json HTTP/1.1 Host: ozbabies.com.au Authorization: Basic HashString Cache-Control: no-cache |
Format | JSON |
---|---|
Return | Error: {"message":"----"} 403 - permission denial 404 - API resource not found Success: 200 - data: [{ "sku", - String "title", - String "price", - Double "available" - Boolean }, ...] |
Get Logistic Provider List:
获取可用物流列表。
Method | GET |
---|---|
Url | <domain.com>/api/v1/logistic_provider/list?_format=json |
Header | [ "Content-Type": "application/json" ] |
Parameter | N/A |
Example | GET /api/v1/logistic_provider/list?_format=json HTTP/1.1 Host: ozbabies.com.au Authorization: Basic HashString Cache-Control: no-cache |
Format | JSON |
---|---|
Return | Error: {"message":"----"} 403 - permission denial 404 - API resource not found Success: 200 - data: [{ "code", - String "title", - String }, ...] |
Get User Store Credit:
获取用户网站credit。
Method | GET |
---|---|
Url | <domain.com>/api/v1/store_credit?_format=json |
Header | [ "Content-Type": "application/json" ] |
Parameter | N/A |
Example | GET /api/v1/store_credit?_format=json HTTP/1.1 Host: ozbabies.com.au Authorization: Basic HashString Cache-Control: no-cache |
Format | JSON |
---|---|
Return | Error: {"message":"----"} 403 - permission denial 404 - API resource not found Success: 200 - data: { "amount", - Float "currency", - String } |
Create Order
建立代发订单接口
Method | POST |
---|---|
Url | <domain.com>/api/v2/order/create?_format=json |
Header | [ "Content-Type": "application/json", "X-CSRF-Token": <token> ] |
Post Payload |
{ |
Format | JSON |
---|---|
Return |
Error: {"message":"----"} |