Authenticate with OAuth-使用OAuth进行身份验证
Order-订单
Location-位置
Fulfillment-配送
Facebook的接口看起来很麻烦,但是用起来比较简单
请求地址domain:https://{shop}.myshopify.com
{shop}
: The name of the user’s shop.店铺名称client_id
: The API key for the app, as defined in the Partner Dashboard.用户名client_secret
: The API secret key for the app, as defined in the Partner Dashboard.密码
1.检索订单列表:GET /admin/api/2020-07/orders.json?status=any
String client_id = "用户名";
String client_secret = "密码";
String shop = "店铺名称";
// 查询指定字段
String scopes = "fields=id,updated_at,fulfillment_Status";
// 查询条件
scopes += "&status=any&created_at_max=2020-10-24T13:25:11+08:00";
String url = "https://shop.myshopify.com/admin/api/2019-10/orders.json";
if (!params.isEmpty()) {
url += "?" + scopes;
}
String strJson = new com.github.kevinsawicki.http.HttpRequest(url, "GET").basic(app_key, app_secret).body();
System.out.println(strJson);
2.检索所有位置列表:GET /admin/api/2020-07/locations.json
3.创建一个新的配送:POST /admin/api/2020-07/orders/{order_id}/fulfillments.json
Fulfill an order using a supported tracking company (generates tracking URL)
POST /admin/api/2020-07/orders/450789469/fulfillments.json
{
"fulfillment": {
"location_id": 905684977, // 通过店铺所有位置列表接口返回的位置id
"tracking_number": "123456789", // 物流单号
"tracking_company": "4PX", // 物流公司id/名称
"line_items": [ // 产品的行项目号
{
"id": 466157049
},
{
"id": 518995019
},
{
"id": 703073504
}
]
}
}