API - 订单

/orders
此端点用于在Lengow API中查询您的订单。选择 接受的参数/ 筛选 在您的查询中精细化您的请求。

/orders/actions
此端点允许您对您的订单执行操作。

获取订单和公约

GET /orders/

这是我们API的主要入口! 此端点将为您提供所有订单的列表。使用 参数/ 筛选 完成此GET请求,以获取您正在寻找的内容。 

公约

在下面找到一些公约点,在向Lengow API发送请求之前,您应该知道。

  • 1. 分页

订单端点支持分页。当省略时,页面的默认值为1。
API可以显示 每页最多100个结果 使用page_size参数。 

示例
/orders/?account_id=1 → 第1页 - 隐式 (默认)
/orders/?account_id=1&page=5&page_size=50 → 第5页 - 显式 (5页,每页最多50个结果)

  • 2. 排序

您可以使用排序参数控制结果的排序。要反转排序,您可以在字区分前加上-支持排序字区分的列表 这里。  

默认排序是:marketplace-marketplace_order_date-imported_at
示例: /orders/?account_id=1&ordering=marketplace,-updated_at

  • 3. 查询参数(筛选)

您可以使用URL字区分和Params标签发送 查询参数。
account_id是必需的参数。对于您发送到API的任何请求/操作,请使用它
这些查询参数将帮助您获取特定的订单,例如,添加"&marketplace_order_id"或者获取来自特定市场的所有订单。示例: /orders/?account_id=1&marketplace=menlook 

  • 4.  更改货币

默认情况下,所有金额字区分都以您的帐户货币返回。

如果您想更改货币,可以使用set_currency参数。该值必须以三个字符指定(ISO 4217)。
示例: /orders/?account_id=1&set_currency=USD  

使用符号"&"使用尽可能多的参数。
示例: /orders/?account_id=1&lengow_status=waiting_shipment&marketplace_order_id=1123456789  

 

典型的GET订单API响应

检索到的信息因市场而异
市场决定他们在API中提供哪些数据以及在哪些字区分中。在Lengow API中,此数据按提供的方式显示。

API响应示例:

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"marketplace": "amazon_uk",
"account_id": 1,
"marketplace_country_iso2": "GB",
"marketplace_order_id": "order1",
"merchant_order_id": null,
"marketplace_status": "Shipped",
"lengow_status": "shipped",
"workflow_rank": 6,
"marketplace_order_date": "2019-03-22T17:54:34.369000Z",
"total_order": 809.2900000000001,
"total_tax": "134.45",
"shipping": 2.6,
"discount": 0,
"commission": "-56.47",
"processing_fee": null,
"currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "Euro"
},
"original_currency": {
"iso_a3": "GBP",
"symbol": "£",
"name": "British Pound"
},
"original_total_order": 701.25,
"original_total_tax": "116.50",
"original_shipping": 2.25,
"original_discount": 0,
"original_commission": "-48.93",
"original_processing_fee": null,
"comments": null,
"invoice_number": null,
"invoice_url": null,
"payments": [
{
"id": 1,
"checkout": null,
"status": null,
"type": "Other: Standard",
"settled_at": null,
"payment_terms": null,
"channel_order_marketplace": 1
}
],
"packages": [
{
"cart": [
{
"id": 1,
"marketplace_order_line_id": "line1",
"marketplace_product_id": "product1",
"merchant_product_id": {
"field": "ID_PRODUCT",
"id": "Product1"
},
"feed_id": 1,
"marketplace_package_id": null,
"marketplace_status": "Shipped",
"lengow_status": "shipped",
"title": "Product TEST",
"category": null,
"url_product": nu<l,>
"url_image": null,
"order_line_meta": {
},
"amount": "806.69",
"tax": "134.45",
"discount": null,
"shipping": "2.60",
"original_amount": "699.00",
"original_tax": "116.50",
"original_discount": null,
"original_shipping": "2.25",
"quantity": 1,
"created_at": null,
"updated_at": null
}
],
"delivery": {
"id": 1,
"type": "delivery",
"first_line": "1 Rue de la Paix",
"zipcode": "44",
"city": "Nantes",
"company": null,
"civility": null,
"first_name": null,
"last_name": null,
"second_line": null,
"complement": null,
"phone_home": null,
"phone_office": null,
"phone_mobile": null,
"full_address": null,
"full_name": "Dupont",
"email": "test@lengow.amazon.co.uk",
"metas": null,
"state_region": "",
"common_country_iso_a2": "GB",
"trackings": [
{
"number": null,
"method": "Standard",
"carrier": null,
"url": null,
"is_delivered_by_marketplace": true,
"parcel_weight": null,
"shipped_at": null,
"relay": {
"name": null,
"id": null
},
"marketplace_order_line_ids": [
"line1"
]
}
]
}
}
],
"billing_address": {
"id": 2,
"type": "billing",
"first_line": null,
"zipcode": "44",
"city": "Nantes",
"company": null,
"civility": null,
"first_name": null,
"last_name": null,
"second_line": null,
"complement": null,
"phone_home": null,
"phone_office": null,
"phone_mobile": null,
"full_address": null,
"full_name": "Dupont",
"email": "test@lengow.amazon.co.uk",
"metas": null,
"state_region": "",
"common_country_iso_a2": "GB"
},
"contact_address": null,
"imported_at": "2019-03-22T20:05:35.196060Z",
"updated_at": "2019-03-25T11:48:09.071000Z",
"order_meta": {
"checksum": "fffffffggghghhgu"
},
"anonymized": false
}
]
}</l,>

在响应中,您会找到市场发送的几个元素,所有这些元素都在不同的对象中分类,每个对象都有多个变量。

市场发送的订单所有细节,如市场订单ID,市场状态(订单状态),订单总额市场订单日期将帮助您对订单采取行动。

所有订单项都是订单的一部分。如果客户只订购1个项目,那么只能有一个项目,或者如果客户在同一客户订单中订购多个项目,则可能有更多项目。

提示:在"tracking"对象中找到"is_delivered_by_marketplace"信息。

支持的参数列表

GET /orders/?account_id=1&marketplace=amazon_uk,darty

以下是您可以添加到此端点的请求以筛选结果的可能参数列表:

  • account_id: 您的Lengow帐户的ID。必填 筛选。对于任何请求或操作都使用它
  • marketplace: 市场名称,可以是多个,但用逗号分隔。例如:"amazon_uk",或者"amazon_uk,darty"  
  • marketplace_order_id: 订单的ID
  • merchant_order_id
  • lengow_status: Lengow状态,可以是一个或多个状态,但用逗号分隔。 例如:"shipped", "shipped, waiting_shipment"
  • marketplace_status
  • lengow_line_status: 获取至少有一个订单行处于请求状态的订单。例如: "lengow_line_status=refunded"
  • marketplace_order_date_from:  必填。默认设置为当前日期 - 7天。
  • marketplace_order_date_to:  默认设置为当前日期。
  • order_type: 示例:"is_business", "is_business, is_express"
  • imported_from
  • imported_to
  • updated_from
  • updated_to
  • set_currency
注意 如果您使用的参数不被我们的API支持或尚未开发,您的请求可能会出错或 参数将被简单地忽略。
示例:"is_delivered_by_marketplace"不是一个有效的 筛选,但在 API响应 中作为一个字区分存在。所以如果在请求或操作中使用,它将被忽略。
每个市场都有自己的状态。在Lengow,所有这些状态都被转换为Lengow状态   

获取所有订单的操作

GET /orders/actions/ 
您可以通过“queued”和“processed”字区分跟踪每个操作的状态。
  • queued:true 
意味着该操作正在等待处理(或在失败时重试)
  • "queued": false
意味着该操作已被处理
  • “processed”: true 
意味着该操作有效并已成功发送
  • "processed": false
意味着该操作无效,检查"error"参数。
示例: 
{
"id": 123456789,
"marketplace_order_id": "306-1234567-1234567",
"account_id": 1,
"marketplace": "amazon_de",
"action_type": "ship",
"processed": true,
"queued": false,
"tracking_number": "05348000966072J",
"tracking_url": null,
"carrier": "DPD",
"custom_carrier": null,
"line": "39751459711155",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": "DPD",
"shipping_date": "2020-10-28T14:35:07+01:00",
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-10-28T13:35:07.301140Z",
"updated_at": "2020-10-28T13:38:19.909097Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": "The tracking ID 05348000966072J for DPD does not match the expected format of the carrier. Please verify that you have entered the tracking ID and carrier name correctly.",
"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
},
这个"GET"操作也可以让你通过查看"errors"参数来检查订单是否有错误。
阅读我们的 使用案例 以获取更多详情。

在订单上创建一个操作

POST /orders/actions/
通过这个端点,你可以对你的订单进行操作。

  • 这是你可以发货,取消或退款订单的地方,如果这些操作 被市场接受的话。
本文已自动翻译。如有疑问,请参阅英文或法文原文。

此组别内的文章

Lengow Academy
立即获取我们的在线学习平台,助您充分挖掘Lengow Suite的全部潜力