"delivery_experience": null,
"return_tracking_number": null,
"refund_price": null,
"refund_shipping_price": null,
"refund_mode": null,
"refund_reason": null,
"refund_quantity": null,
"refund_shipping": null,
"refund_shipping_taxes": null,
"refund_taxes": null,
"carrier_name": null,
"carrier_pickup": null,
"package_dimension_length": null,
"package_dimension_width": null,
"package_dimension_height": null,
"package_dimension_unit": null,
"from_address_name": null,
"from_address_line": null,
"from_address_city": null,
"from_address_state_province": null,
"from_address_postal_code": null,
"from_address_country_code": null,
"from_address_mail": null,
"from_address_phone": null,
"pickup_id": null,
"refund_id": null,
"return_carrier": null
}
]
}
- API响应
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
在结果中,你可以看到订单id出现了两次。这意味着服务器因为进行了两个操作而显示了同一个订单两次。 最后一个操作显示在响应的顶部。
- "action_type"
- "processed"
- "queued"
- "error"
1/ 第一个 “ship”操作,Julia早些时候发送的, 是无效的 因为我们在API响应中看到:
"processed": false
"error": "Tracking needs number AND carrier for ship order action"
这里,eBay API告诉Lengow的API,Julia的"ship"操作 是不完整的 因为一个或多个参数缺失。
- 你可以看到参数 "tracking_number"在第一个"ship"操作中是null。
- "processed": true
- "queued": false
- "error": null
关于"queued"和"processed"对象的更多信息 在这里。
获取订单的发货信息
Julia,我们的测试商家,从La Redoute市场收到了一个新订单。她想找到所需的发货信息以帮助她发货订单。
GET /orders/?account_id=1&marketplace_order_id=2020.111.123456789
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"marketplace": "laredoute",
"account_id": 1,
"marketplace_country_iso2": "FR",
"marketplace_order_id": "2020.111.123456789",
"merchant_order_id": [
"1234567"
],
"marketplace_status": "ToShip",
"lengow_status": "waiting_shipment",
"workflow_rank": 5,
"marketplace_order_date": "2020-11-12T15:23:18Z",
"total_order": 74.8,
"total_tax": "0.00",
"shipping": 9.9,
"discount": 0.0,
"commission": null,<在这里找到一些提示和使用案例,帮助您设置我们的API的请求和操作。
为了说明这些使用案例,我们选择了一个测试商家。
- 我们把我们的测试商家叫做"Julia",并说她的账号是"1"。
- 请注意,她正在使用 Postman 来进行所有的API调用。
- 结果将以JSON格式呈现
- 这些使用案例都是纯粹的例子
关于Postman以及如何创建一个集合(保存的请求组)的更多信息,在这里。
连接到我们的API:获取访问令牌
- 在Lengow API中进行请求调用或任何操作的第一步是进入API。
为此,Julia需要从她的Lengow账户中收集她的凭证,这些凭证是:
- Lengow账户ID
- 密钥令牌
- 令牌
并打开Postman。
然后,一旦她在Postman中用她的凭证设置了一个新的环境,她就可以进行并POST第一次调用 ,即:
POST /access/get_token
- API会返回一个访问令牌,如下所示:
{
"token": "69946b78-edae-49b8-8874-6fb025e09a58",
"account_id": 1
}
她将这个令牌添加到她的Postman环境中,变量名为LENGOW_AUTH(见下图)。
Lengow API发送的"令牌"有效期为3600秒,现在可以在Postman中作为Lengow_AUTH使用。
提示: 在开发人员的帮助下,您可以设置一个脚本,每小时自动进行这个调用。
检查订单上的操作
Julia已经纠正了她在一个订单上的发货操作。她想检查她的最后一个操作是否正确,以及她发送的操作是否已经被Lengow API正确地处理并传递给渠道的API。
- GET /orders/actions/
从Lengow API,她使用 "&marketplace_order_id" 参数查询这个特定的订单,并使用她的订单ID(见下文)。
-- endpoint /orders/actions --
-- GET method --
GET /orders/actions/?account_id=1&marketplace_order_id=12-05319-12345
-- API response --
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 13244460,
"marketplace_order_id": "12-05319-123452",
"account_id": 1,
"marketplace": "ebay_fr",
"action_type": "ship",
"processed": true,
"queued": false,
"tracking_number": "2L01286914523",
"tracking_url": null,
"carrier": "FR_ColiposteColissimoRecommended",
"custom_carrier": null,
"line": "193393034918-1749999860009",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": null,
"shipping_date": null,
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-07-02T08:03:37.912433Z",
"updated_at": "2020-07-02T08:03:39.262053Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": null,
"delivery_date": null,
"delivery_experience": null,
"return_tracking_number": null,
"refund_price": null,
"refund_shipping_price": null,
"refund_mode": null,
"refund_reason": null,
"refund_quantity": null,
"refund_shipping": null,
"refund_shipping_taxes": null,
"refund_taxes": null,
"carrier_name": null,
"carrier_pickup": null,
"package_dimension_length": null,
"package_dimension_width": null,
"package_dimension_height": null,
"package_dimension_unit": null,
"from_address_name": null,
"from_address_line": null,
"from_address_city": null,
"from_address_state_province": null,
"from_address_postal_code": null,
"from_address_country_code": null,
"from_address_mail": null,
"from_address_phone": null,
"pickup_id": null,
"refund_id": null,
"return_carrier": null
},
{
"id": 13244455,
"marketplace_order_id": "12-05319-123452",
"account_id": 1,
"marketplace": "ebay_fr",
"action_type": "ship",
"processed": false,
"queued": false,
"tracking_number": null,
"tracking_url": null,
"carrier": "FR_ColiposteColissimoRecommended",
"custom_carrier": null,
"line": "193393034918-1749999860009",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": null,
"shipping_date": null,
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-07-02T08:02:50.609088Z",
"updated_at": "2020-07-02T08:02:50.681358Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": "Tracking needs number AND carrier for ship order action",
>"processing_fee": null,
"currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "欧元"
},
"original_currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "欧元"
},
"original_total_order": 74.8,
"original_total_tax": "0.00",
"original_shipping": 9.9,
"original_discount": 0.0,
"original_commission": null,
"original_processing_fee": null,
"comments": null,
"invoice_number": null,
"invoice_url": null,
"payments": [],
"packages": [
{
"cart": [
{
"id": 8623271,
"marketplace_order_line_id": "2020.111.123456789-1",
"marketplace_product_id": "4001072020053",
"merchant_product_id": {
"field": "ID_PRODUCT",
"id": "111111"
},
"feed_id": 12345,
"marketplace_package_id": null,
"marketplace_status": "ToShip",
"lengow_status": "等待发货",
"title": "自动幻灯片查看器 - Diascop 3",
"category": "首页 > 配件 > 查看器",
"url_product": null,
"url_image": null,
"order_line_meta": {
"DeliveryMode": "Home",
"DeliveryType": "Regular"
},
"amount": "64.90",
"tax": "0.00",
"discount": null,
"shipping": null,
"original_amount": "64.90",
"original_tax": "0.00",
"original_discount": null,
"original_shipping": null,
"quantity": 1,
"documents": [],
"created_at": null,
"updated_at": null,
"orderline_types": []
}
],
"delivery": {
"id": 151186892,
"type": "delivery",
"first_line": "500 AVENUE TEST",
"zipcode": "69300",
"city": "CALUIRE ET CUIRE",
"vat_number": null,
"company": null,
"civility": "先生",
"first_name": null,
"last_name": null,
"second_line": "",
"complement": "3E楼",
"phone_home": null,
"phone_office": null,
"phone_mobile": "06700000000",
"full_address": null,
"full_name": "TEST BOB DUPONT",
"email": "*****.fr",
"metas": null,
"state_region": null,
"common_country_iso_a2": "FR",
"trackings": [
{
"number": null,
"method": "家庭 / 常规",
"carrier": null,
"url": null,
"is_delivered_by_marketplace": null,
"parcel_weight": null,
"shipped_at": null,
"pickup_store": {
"id": null
},
"relay": {
"id": null,
"name": null
},
"marketplace_order_line_ids": [
"2020.111.123456789-1"
]
}
]
}
}
],
"billing_address": {
"id": 151198390,
"type": "billing",
"first_line": "500 AVENUE TEST",
"zipcode": "69300",
"city": "CALUIRE ET CUIRE",
"vat_number": null,
"company": null,
"civility": "先生",
"first_name": null,
"last_name": null,
"second_line": "",
"complement": "3E楼",
"phone_home": null,
"phone_office": null,
"phone_mobile": "06700000000",
"full_address": null,
"full_name": "TEST BOB DUPONT",
"email": "*****.fr",
"metas": null,
"state_region": null,
"common_country_iso_a2": "FR"
},
"contact_address": null,
"documents": [],
"imported_at": "2020-11-12T16:09:07.256186Z",
"updated_at": "2020-11-12T16:32:15.849000Z",
"order_meta": {
"checksum": "b4aa946ef504ed758359db880c03bd62"
},
"anonymized": false,
"order_types": []
}
]
}
- 订单处于"等待发货"状态。
从API响应的 "delivery" > "trackings" 参数中,Julia可以检查客户选择的交付方式:
- "method": "家庭 / 常规"
从这个"tracking"参数,可以找到其他信息,并根据客户选择的交付方式进行补充:
"is_delivered_by_marketplace": null,
"pickup_store": { "id": null },
"relay": { "id": null, "name": null
注意:如果选择了"Relais / Regular"方法,订单的"relay"参数将会用接力点的标识符和名称进行填充。
步骤2
然后,Julia 查询整体市场信息 以了解 需要填写哪些必要元素 以正确发货。
从API中,这次她使用的是/marketplace端点:
GET /marketplaces/?marketplace=laredoute
在Lengow API返回的响应中,她可以找到
- 订单状态列表
- 对订单的授权操作和每个操作需要完成的必要参数
- 在"carriers"标签中的市场授权的运营商
对于La Redoute,她找到了:
"actions": {
"ship": {
"args": [
"carrier",
"tracking_number"
],
然后她查阅"carrier"标签,以了解是否必须有有效值:
"carrier": {
"type": "string",
"valid_values": {},
"default_value": "",
"accept_free_values": true
这意味着为了验证她的La Redoute订单(家庭送货),Julia必须提供
- "carrier"信息
- 一个"tracking_number"
由于没有强制性的运营商列表,她可以选择自己的运营商。
获取文件
Julia,我们的测试商家,收到了来自Zalando市场的新订单。她想下载她被要求在包裹中附上的文件:发票,送货单和退货表。
注意:这些文件由Lengow编辑,也可以在Lengow平台上下载,如我们的Zalando指南中所述。
步骤1
一旦连接到Lengow API,她像这样查询她的订单使用/orders端点:
GET /orders/?account_id=1&marketplace_order_id=10987654321
在Lengow API返回的响应中,她找到了"documents"部分,她可以在那里获取这些文件的ID:
"documents": [
{
"id": 2111112,
"marketplace_doc_id": "DELIVERY_NOTE_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111112",
"created_at": "2022-05-14T06:26:19.479581Z",
"doc_type": {
"lengow_type": "DELIVERY",
"marketplace_code": "DELIVERY_NOTE",
"marketplace_label": "Zalando送货单"
}
},
{
"id": 2111111,
"marketplace_doc_id": "RETURN_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111111",
"created_at": "2022-05-14T06:26:19.478343Z",
"doc_type": {
"lengow_type": "RETURN",
"marketplace_code": "RETURN",
"marketplace_label": "Zalando退货表"
}
},
{
"id": 2111110,
"marketplace_doc_id": "BILL_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111110",
"created_at": "2022-05-14T06:26:19.475280Z",
"doc_type": {
"lengow_type": "BILL",
"marketplace_code": "BILL",
"marketplace_label": "Zalando发票"
}
}
]
步骤2
使用她找到的文档ID(在此示例中为2111110,2111111和2111112),Julia使用/document端点下载相应的文档(每个文档一次调用):
GET /document/2111110?account_id=1
在Postman中可见的结果: