lingxingapi 1.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lingxingapi/__init__.py +7 -0
- lingxingapi/ads/__init__.py +0 -0
- lingxingapi/ads/api.py +5946 -0
- lingxingapi/ads/param.py +192 -0
- lingxingapi/ads/route.py +134 -0
- lingxingapi/ads/schema.py +2615 -0
- lingxingapi/api.py +557 -0
- lingxingapi/base/__init__.py +0 -0
- lingxingapi/base/api.py +568 -0
- lingxingapi/base/param.py +59 -0
- lingxingapi/base/route.py +11 -0
- lingxingapi/base/schema.py +198 -0
- lingxingapi/basic/__init__.py +0 -0
- lingxingapi/basic/api.py +466 -0
- lingxingapi/basic/param.py +72 -0
- lingxingapi/basic/route.py +20 -0
- lingxingapi/basic/schema.py +218 -0
- lingxingapi/errors.py +152 -0
- lingxingapi/fba/__init__.py +0 -0
- lingxingapi/fba/api.py +1691 -0
- lingxingapi/fba/param.py +250 -0
- lingxingapi/fba/route.py +30 -0
- lingxingapi/fba/schema.py +987 -0
- lingxingapi/fields.py +50 -0
- lingxingapi/finance/__init__.py +0 -0
- lingxingapi/finance/api.py +3091 -0
- lingxingapi/finance/param.py +616 -0
- lingxingapi/finance/route.py +44 -0
- lingxingapi/finance/schema.py +1243 -0
- lingxingapi/product/__init__.py +0 -0
- lingxingapi/product/api.py +2643 -0
- lingxingapi/product/param.py +934 -0
- lingxingapi/product/route.py +49 -0
- lingxingapi/product/schema.py +1004 -0
- lingxingapi/purchase/__init__.py +0 -0
- lingxingapi/purchase/api.py +496 -0
- lingxingapi/purchase/param.py +126 -0
- lingxingapi/purchase/route.py +11 -0
- lingxingapi/purchase/schema.py +215 -0
- lingxingapi/sales/__init__.py +0 -0
- lingxingapi/sales/api.py +3200 -0
- lingxingapi/sales/param.py +723 -0
- lingxingapi/sales/route.py +70 -0
- lingxingapi/sales/schema.py +1718 -0
- lingxingapi/source/__init__.py +0 -0
- lingxingapi/source/api.py +1799 -0
- lingxingapi/source/param.py +176 -0
- lingxingapi/source/route.py +38 -0
- lingxingapi/source/schema.py +1011 -0
- lingxingapi/tools/__init__.py +0 -0
- lingxingapi/tools/api.py +291 -0
- lingxingapi/tools/param.py +73 -0
- lingxingapi/tools/route.py +8 -0
- lingxingapi/tools/schema.py +169 -0
- lingxingapi/utils.py +456 -0
- lingxingapi/warehourse/__init__.py +0 -0
- lingxingapi/warehourse/api.py +1778 -0
- lingxingapi/warehourse/param.py +506 -0
- lingxingapi/warehourse/route.py +28 -0
- lingxingapi/warehourse/schema.py +926 -0
- lingxingapi-1.1.4.dist-info/METADATA +73 -0
- lingxingapi-1.1.4.dist-info/RECORD +65 -0
- lingxingapi-1.1.4.dist-info/WHEEL +5 -0
- lingxingapi-1.1.4.dist-info/licenses/LICENSE +22 -0
- lingxingapi-1.1.4.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1799 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-c
|
|
2
|
+
import datetime
|
|
3
|
+
from typing import Literal
|
|
4
|
+
from lingxingapi import errors
|
|
5
|
+
from lingxingapi.base.api import BaseAPI
|
|
6
|
+
from lingxingapi.source import param, route, schema
|
|
7
|
+
|
|
8
|
+
# Type Aliases ---------------------------------------------------------------------------------------------------------
|
|
9
|
+
ORDER_DATE_TYPE = Literal["update_date", "request_date"]
|
|
10
|
+
SEARCH_FIELD = Literal["asin", "msku", "fnsku", "title", "transaction_item_id"]
|
|
11
|
+
REPORT_REGION = Literal["NA", "EU", "FE"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# API ------------------------------------------------------------------------------------------------------------------
|
|
15
|
+
class SourceAPI(BaseAPI):
|
|
16
|
+
"""领星API `亚马逊源数据` 接口
|
|
17
|
+
|
|
18
|
+
## Notice
|
|
19
|
+
请勿直接实例化此类
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# 公共 API --------------------------------------------------------------------------------------
|
|
23
|
+
# 订单数据 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
24
|
+
async def Orders(
|
|
25
|
+
self,
|
|
26
|
+
sid: int,
|
|
27
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
28
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
29
|
+
*,
|
|
30
|
+
date_type: int | None = None,
|
|
31
|
+
offset: int | None = None,
|
|
32
|
+
length: int | None = None,
|
|
33
|
+
) -> schema.Orders:
|
|
34
|
+
"""查询亚马逊所有类型(FBA & FBM)的源订单
|
|
35
|
+
|
|
36
|
+
## Docs
|
|
37
|
+
- 亚马逊源表数据: [查询亚马逊源报表-所有订单](https://apidoc.lingxing.com/#/docs/SourceData/AllOrders)
|
|
38
|
+
- 对应亚马逊 'All Orders Report By Last Update' 源报告
|
|
39
|
+
|
|
40
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
41
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
42
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
43
|
+
:param date_type `<'int/None'>`: 日期类型, 默认 `None` (使用: 1)
|
|
44
|
+
|
|
45
|
+
- `1`: 下单日期
|
|
46
|
+
- `2`: 亚马逊订单更新时间
|
|
47
|
+
|
|
48
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
49
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
50
|
+
:returns `<'Orders'>`: 返回查询到的亚马逊所有类型(FBA & FBM)的源订单结果
|
|
51
|
+
```python
|
|
52
|
+
{
|
|
53
|
+
# 状态码
|
|
54
|
+
"code": 0,
|
|
55
|
+
# 提示信息
|
|
56
|
+
"message": "success",
|
|
57
|
+
# 错误信息
|
|
58
|
+
"errors": [],
|
|
59
|
+
# 请求ID
|
|
60
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
61
|
+
# 响应时间
|
|
62
|
+
"response_time": "2025-08-13 19:23:04",
|
|
63
|
+
# 响应数据量
|
|
64
|
+
"response_count": 2,
|
|
65
|
+
# 总数据量
|
|
66
|
+
"total_count": 2,
|
|
67
|
+
# 响应数据
|
|
68
|
+
"data": [
|
|
69
|
+
{
|
|
70
|
+
# 领星店铺ID
|
|
71
|
+
"sid": 1,
|
|
72
|
+
# 亚马逊订单编号
|
|
73
|
+
"amazon_order_id": "113-*******-*******",
|
|
74
|
+
# 卖家提供的订单编号
|
|
75
|
+
"merchant_order_id": "113-*******-*******",
|
|
76
|
+
# 配送方式 ("Amazon" [AFN] 或 "Merchant" [MFN])
|
|
77
|
+
"fulfillment_channel": "Amazon",
|
|
78
|
+
# 销售渠道 (如: "Amazon.com")
|
|
79
|
+
"sales_channel": "Amazon.com",
|
|
80
|
+
# 销售子渠道 (CBA/WBA) [原字段 'order_channel']
|
|
81
|
+
"sales_sub_channel": "",
|
|
82
|
+
# 订单配送服务级别 [原字段 'ship_service_level']
|
|
83
|
+
"shipment_service": "Expedited",
|
|
84
|
+
# 是否为B2B订单 [原字段 'is_business_order']
|
|
85
|
+
"is_b2b_order": "false",
|
|
86
|
+
# 订单状态
|
|
87
|
+
"order_status": "Shipped",
|
|
88
|
+
# 订单商品状态 [原字段 'item_status']
|
|
89
|
+
"order_item_status": "Shipped",
|
|
90
|
+
# 领星产品ID [原字段 'pid']
|
|
91
|
+
"product_id": 2*****,
|
|
92
|
+
# 领星产品名称 [原字段 'local_name']
|
|
93
|
+
"product_name": "Apple",
|
|
94
|
+
# 商品ASIN
|
|
95
|
+
"asin": "B0D*******",
|
|
96
|
+
# 亚马逊SKU [原字段 'sku']
|
|
97
|
+
"msku": "SKU*********",
|
|
98
|
+
# 本地SKU [原字段 'local_sku']
|
|
99
|
+
"lsku": "LOCAL********",
|
|
100
|
+
# 商品标题 [原字段 'product_name']
|
|
101
|
+
"title": "Product Title",
|
|
102
|
+
# ASIN链接 [原字段 'url']
|
|
103
|
+
"asin_url": "",
|
|
104
|
+
# 商品促销标识 [原字段 'promotion_ids']
|
|
105
|
+
"promotion_labels": "",
|
|
106
|
+
# 订单商品总数量 [原字段 'quantity']
|
|
107
|
+
"order_qty": 1,
|
|
108
|
+
# 商品销售金额 [原字段 'item_price']
|
|
109
|
+
"sales_amt": 27.98,
|
|
110
|
+
# 商品销售金额税费 [原字段 'item_tax']
|
|
111
|
+
"sales_tax_amt": 2.31,
|
|
112
|
+
# 买家支付运费金额 [原字段 'shipping_price']
|
|
113
|
+
"shipping_credits_amt": 0.33,
|
|
114
|
+
# 买家支付运费税费 [原字段 'shipping_tax']
|
|
115
|
+
"shipping_credits_tax_amt": 0.0,
|
|
116
|
+
# 买家支付礼品包装费金额 [原字段 'gift_wrap_price']
|
|
117
|
+
"giftwrap_credits_amt": 0.0,
|
|
118
|
+
# 买家支付礼品包装费税费 [原字段 'gift_wrap_tax']
|
|
119
|
+
"giftwrap_credits_tax_amt": 0.0,
|
|
120
|
+
# 卖家商品促销折扣金额 [原字段 'item_promotion_discount']
|
|
121
|
+
"promotion_discount_amt": 0.0,
|
|
122
|
+
# 卖家商品运费折扣金额 [原字段 'ship_promotion_discount']
|
|
123
|
+
"shipping_discount_amt": 0.33,
|
|
124
|
+
# 货币代码 [原字段 'currency']
|
|
125
|
+
"currency_code": "USD",
|
|
126
|
+
# 买家国家代码 [原字段 'ship_country']
|
|
127
|
+
"buyer_country_code": "US",
|
|
128
|
+
# 买家州/省 [原字段 'ship_state']
|
|
129
|
+
"buyer_state": "TX",
|
|
130
|
+
# 买家城市 [原字段 'ship_city']
|
|
131
|
+
"buyer_city": "ROWLETT",
|
|
132
|
+
# 买家邮编 [原字段 'ship_postal_code']
|
|
133
|
+
"buyer_postcode": "75088-8321",
|
|
134
|
+
# 订单购买时间 (UTC时间) [原字段 'purchase_date']
|
|
135
|
+
"purchase_time_utc": "2025-08-23T18:54:00+00:00",
|
|
136
|
+
# 订单购买时间 (本地时间) [原字段 'purchase_date_local']
|
|
137
|
+
"purchase_time_loc": "2025-08-23 11:54:00",
|
|
138
|
+
# 订单购买日期 (本地日期) [原字段 'purchase_date_locale']
|
|
139
|
+
"purchase_date_loc": "2025-08-23",
|
|
140
|
+
# 订单发货时间 (本地时间) [原字段 'shipment_date']
|
|
141
|
+
"shipment_time_loc": "2025-08-23T23:48:09-07:00",
|
|
142
|
+
# 订单更新时间 (时间戳) [原字段 'last_updated_time']
|
|
143
|
+
"update_time_ts": 1756248908,
|
|
144
|
+
},
|
|
145
|
+
...
|
|
146
|
+
],
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
"""
|
|
150
|
+
url = route.ORDERS
|
|
151
|
+
# 解析并验证参数
|
|
152
|
+
args = {
|
|
153
|
+
"sid": sid,
|
|
154
|
+
"start_date": start_date,
|
|
155
|
+
"end_date": end_date,
|
|
156
|
+
"date_type": date_type,
|
|
157
|
+
"offset": offset,
|
|
158
|
+
"length": length,
|
|
159
|
+
}
|
|
160
|
+
try:
|
|
161
|
+
p = param.Orders.model_validate(args)
|
|
162
|
+
except Exception as err:
|
|
163
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
164
|
+
|
|
165
|
+
# 发送请求
|
|
166
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
167
|
+
return schema.Orders.model_validate(data)
|
|
168
|
+
|
|
169
|
+
async def FbaOrders(
|
|
170
|
+
self,
|
|
171
|
+
sid: int,
|
|
172
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
173
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
174
|
+
*,
|
|
175
|
+
date_type: int | None = None,
|
|
176
|
+
offset: int | None = None,
|
|
177
|
+
length: int | None = None,
|
|
178
|
+
) -> schema.FbaOrders:
|
|
179
|
+
"""查询亚马逊FBA源订单
|
|
180
|
+
|
|
181
|
+
## Docs
|
|
182
|
+
- 亚马逊源表数据: [查询亚马逊源报表-FBA订单](https://apidoc.lingxing.com/#/docs/SourceData/FbaOrders)
|
|
183
|
+
- 对应亚马逊 'Amazon-Fulfilled Shipments Report' 源报告
|
|
184
|
+
|
|
185
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
186
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
187
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
188
|
+
:param date_type `<'int/None'>`: 日期类型, 默认 `None` (使用: 1)
|
|
189
|
+
|
|
190
|
+
- `1`: 下单日期
|
|
191
|
+
- `2`: 配送日期
|
|
192
|
+
|
|
193
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
194
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
195
|
+
:returns `<'FbaOrders'>`: 返回查询到的亚马逊FBA源订单结果
|
|
196
|
+
```python
|
|
197
|
+
{
|
|
198
|
+
# 状态码
|
|
199
|
+
"code": 0,
|
|
200
|
+
# 提示信息
|
|
201
|
+
"message": "success",
|
|
202
|
+
# 错误信息
|
|
203
|
+
"errors": [],
|
|
204
|
+
# 请求ID
|
|
205
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
206
|
+
# 响应时间
|
|
207
|
+
"response_time": "2025-08-13 19:23:04",
|
|
208
|
+
# 响应数据量
|
|
209
|
+
"response_count": 2,
|
|
210
|
+
# 总数据量
|
|
211
|
+
"total_count": 2,
|
|
212
|
+
# 响应数据
|
|
213
|
+
"data": [
|
|
214
|
+
{
|
|
215
|
+
# 亚马逊订单编号
|
|
216
|
+
"amazon_order_id": "114-*******-*******",
|
|
217
|
+
# 亚马逊订单商品编号
|
|
218
|
+
"amazon_order_item_id": "1367***********",
|
|
219
|
+
# 配送方式 (AFN 或 MFN)
|
|
220
|
+
"fulfillment_channel": "AFN",
|
|
221
|
+
# 亚马逊货件编号
|
|
222
|
+
"shipment_id": "Bqy******",
|
|
223
|
+
# 亚马逊货件商品编号
|
|
224
|
+
"shipment_item_id": "DLXY*********",
|
|
225
|
+
# 订单配送服务级别 [原字段 'ship_service_level']
|
|
226
|
+
"shipment_service": "Expedited",
|
|
227
|
+
# 承运商代码 [原字段 'carrier']
|
|
228
|
+
"shipment_carrier": "AMZN_US",
|
|
229
|
+
# 追踪单号
|
|
230
|
+
"tracking_number": "TBA************",
|
|
231
|
+
# 亚马逊SKU [原字段 'sku']
|
|
232
|
+
"msku": "SKU*********",
|
|
233
|
+
# 商品标题 [原字段 'product_name']
|
|
234
|
+
"title": "Product Title",
|
|
235
|
+
# 发货商品数量 [原字段 'quantity_shipped']
|
|
236
|
+
"shipped_qty": 1,
|
|
237
|
+
# 商品销售金额 [原字段 'item_price']
|
|
238
|
+
"sales_amt": 34.98,
|
|
239
|
+
# 商品销售金额税费 [原字段 'item_tax']
|
|
240
|
+
"sales_tax_amt": 2.54,
|
|
241
|
+
# 买家支付运费金额 [原字段 'shipping_price']
|
|
242
|
+
"shipping_credits_amt": 0.0,
|
|
243
|
+
# 买家支付运费税费 [原字段 'shipping_tax']
|
|
244
|
+
"shipping_credits_tax_amt": 0.0,
|
|
245
|
+
# 买家支付礼品包装费金额 [原字段 'gift_wrap_price']
|
|
246
|
+
"giftwrap_credits_amt": 0.0,
|
|
247
|
+
# 买家支付礼品包装费税费 [原字段 'gift_wrap_tax']
|
|
248
|
+
"giftwrap_credits_tax_amt": 0.0,
|
|
249
|
+
# 卖家商品促销折扣金额 [原字段 'item_promotion_discount']
|
|
250
|
+
"promotion_discount_amt": 0.0,
|
|
251
|
+
# 卖家商品运费折扣金额 [原字段 'ship_promotion_discount']
|
|
252
|
+
"shipping_discount_amt": 0.0,
|
|
253
|
+
# 亚马逊积分抵付款金额 (日本站) [原字段 'points_granted']
|
|
254
|
+
"points_discount_amt": 0.0,
|
|
255
|
+
# 货币代码 [原字段 'currency']
|
|
256
|
+
"currency_code": "USD",
|
|
257
|
+
# 买家国家代码 [原字段 'ship_country']
|
|
258
|
+
"buyer_country_code": "US",
|
|
259
|
+
# 买家州/省 [原字段 'ship_state']
|
|
260
|
+
"buyer_state": "NC",
|
|
261
|
+
# 买家城市 [原字段 'ship_city']
|
|
262
|
+
"buyer_city": "RALEIGH",
|
|
263
|
+
# 买家地址 [原字段 'ship_address_1']
|
|
264
|
+
"buyer_address": "",
|
|
265
|
+
# 买家邮编 [原字段 'ship_postal_code']
|
|
266
|
+
"buyer_postcode": "27614-9689",
|
|
267
|
+
# 买家名称
|
|
268
|
+
"buyer_name": "",
|
|
269
|
+
# 买家邮箱
|
|
270
|
+
"buyer_email": "****@marketplace.amazon.com",
|
|
271
|
+
# 买家电话 [原字段 'buyer_phone_number']
|
|
272
|
+
"buyer_phone": "",
|
|
273
|
+
# 收件人名称
|
|
274
|
+
"recipient_name": "",
|
|
275
|
+
# 订单购买时间 (UTC时间) [原字段 'purchase_date']
|
|
276
|
+
"purchase_time_utc": "2025-08-17T12:39:08+00:00",
|
|
277
|
+
# 订单支付时间 (UTC时间) [原字段 'payments_date']
|
|
278
|
+
"payments_time_utc": "2025-08-18T09:09:35+00:00",
|
|
279
|
+
# 订单发货时间 (UTC时间) [原字段 'shipment_date']
|
|
280
|
+
"shipment_time_utc": "2025-08-18T08:11:52+00:00",
|
|
281
|
+
# 预计送达时间 (UTC时间) [原字段 'estimated_arrival_date']
|
|
282
|
+
"estimated_arrival_time_utc": "2025-08-19T03:00:00+00:00",
|
|
283
|
+
# 报告数据时间 (UTC时间) [原字段 'reporting_date']
|
|
284
|
+
"report_time_utc": "2025-08-18T09:12:04+00:00",
|
|
285
|
+
},
|
|
286
|
+
...
|
|
287
|
+
],
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
"""
|
|
291
|
+
url = route.FBA_ORDERS
|
|
292
|
+
# 解析并验证参数
|
|
293
|
+
args = {
|
|
294
|
+
"sid": sid,
|
|
295
|
+
"start_date": start_date,
|
|
296
|
+
"end_date": end_date,
|
|
297
|
+
"date_type": date_type,
|
|
298
|
+
"offset": offset,
|
|
299
|
+
"length": length,
|
|
300
|
+
}
|
|
301
|
+
try:
|
|
302
|
+
p = param.Orders.model_validate(args)
|
|
303
|
+
except Exception as err:
|
|
304
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
305
|
+
|
|
306
|
+
# 发送请求
|
|
307
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
308
|
+
return schema.FbaOrders.model_validate(data)
|
|
309
|
+
|
|
310
|
+
async def FbaReplacementOrders(
|
|
311
|
+
self,
|
|
312
|
+
sid: int,
|
|
313
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
314
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
315
|
+
*,
|
|
316
|
+
offset: int | None = None,
|
|
317
|
+
length: int | None = None,
|
|
318
|
+
) -> schema.FbaReplacementOrders:
|
|
319
|
+
"""查询亚马逊FBA换货源订单
|
|
320
|
+
|
|
321
|
+
## Docs
|
|
322
|
+
- 亚马逊源表数据: [查询亚马逊源报表-FBA换货订单](https://apidoc.lingxing.com/#/docs/SourceData/fbaExchangeOrderList)
|
|
323
|
+
- 对应亚马逊 'Replacements Report' 源报告
|
|
324
|
+
|
|
325
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
326
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
327
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
328
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
329
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
330
|
+
:returns `<'FbaReplacementOrders'>`: 返回查询到的亚马逊FBA换货订单结果
|
|
331
|
+
```python
|
|
332
|
+
{
|
|
333
|
+
# 状态码
|
|
334
|
+
"code": 0,
|
|
335
|
+
# 提示信息
|
|
336
|
+
"message": "success",
|
|
337
|
+
# 错误信息
|
|
338
|
+
"errors": [],
|
|
339
|
+
# 请求ID
|
|
340
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
341
|
+
# 响应时间
|
|
342
|
+
"response_time": "2025-08-13 19:23:04",
|
|
343
|
+
# 响应数据量
|
|
344
|
+
"response_count": 2,
|
|
345
|
+
# 总数据量
|
|
346
|
+
"total_count": 2,
|
|
347
|
+
# 响应数据
|
|
348
|
+
"data": [
|
|
349
|
+
{
|
|
350
|
+
# 领星店铺ID
|
|
351
|
+
"sid": 9857,
|
|
352
|
+
# 订单唯一哈希值 (不是唯一键)
|
|
353
|
+
"order_hash": "26f96f**************************",
|
|
354
|
+
# 原始亚马逊订单编号 [原字段 'original_amazon_order_id']
|
|
355
|
+
"amazon_order_id": "113-*******-*******",
|
|
356
|
+
# 原始亚马逊配送中心代码 [原字段 'original_fulfillment_center_id']
|
|
357
|
+
"fulfillment_center_id": "SBD6",
|
|
358
|
+
# 换货商品ASIN
|
|
359
|
+
"asin": "B0D*******",
|
|
360
|
+
# 换货商品SKU [原字段 'seller_sku']
|
|
361
|
+
"msku": "SKU*********",
|
|
362
|
+
# 换货亚马逊订单编号
|
|
363
|
+
"replacement_amazon_order_id": "113-*******-*******",
|
|
364
|
+
# 换货亚马逊配送中心代码 [原字段 'fulfillment_center_id']
|
|
365
|
+
"replacement_fulfillment_center_id": "SBD6",
|
|
366
|
+
# 换货数量 [原字段 'quantity']
|
|
367
|
+
"replacement_qty": 1,
|
|
368
|
+
# 换货原因代码
|
|
369
|
+
"replacement_reason_code": 2,
|
|
370
|
+
# 换货原因描述 [原字段 'replacement_reason_msg']
|
|
371
|
+
"replacement_reason_desc": "Defective(存在缺陷)",
|
|
372
|
+
# 换货时间 (UTC时间) [原字段 'shipment_date']
|
|
373
|
+
"replacement_time_utc": "2025-08-25 17:00:00",
|
|
374
|
+
# 数据同步时间 (时间戳) [原字段 'sync_time']
|
|
375
|
+
"sync_time_ts": -210424147,
|
|
376
|
+
},
|
|
377
|
+
...
|
|
378
|
+
],
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
"""
|
|
382
|
+
url = route.FBA_REPLACEMENT_ORDERS
|
|
383
|
+
# 解析并验证参数
|
|
384
|
+
args = {
|
|
385
|
+
"sid": sid,
|
|
386
|
+
"start_date": start_date,
|
|
387
|
+
"end_date": end_date,
|
|
388
|
+
"offset": offset,
|
|
389
|
+
"length": length,
|
|
390
|
+
}
|
|
391
|
+
try:
|
|
392
|
+
p = param.Orders.model_validate(args)
|
|
393
|
+
except Exception as err:
|
|
394
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
395
|
+
|
|
396
|
+
# 发送请求
|
|
397
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
398
|
+
return schema.FbaReplacementOrders.model_validate(data)
|
|
399
|
+
|
|
400
|
+
async def FbaReturnOrders(
|
|
401
|
+
self,
|
|
402
|
+
sid: int,
|
|
403
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
404
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
405
|
+
*,
|
|
406
|
+
date_type: int | None = None,
|
|
407
|
+
offset: int | None = None,
|
|
408
|
+
length: int | None = None,
|
|
409
|
+
) -> schema.FbaReturnOrders:
|
|
410
|
+
"""查询亚马逊FBA退货源订单
|
|
411
|
+
|
|
412
|
+
## Docs
|
|
413
|
+
- 亚马逊源表数据: [查询亚马逊源报表-FBA退货订单](https://apidoc.lingxing.com/#/docs/SourceData/RefundOrders)
|
|
414
|
+
- 对应亚马逊 'FBA Customer Returns' 源报告
|
|
415
|
+
|
|
416
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
417
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
418
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
419
|
+
:param date_type `<'int/None'>`: 日期类型, 默认 `None` (使用: 1)
|
|
420
|
+
|
|
421
|
+
- `1`: 退货日期 (站点时间)
|
|
422
|
+
- `2`: 更新日期 (北京时间)
|
|
423
|
+
|
|
424
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
425
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
426
|
+
:returns `<'FbaReturnOrders'>`: 返回查询到的亚马逊FBA退货源订单结果
|
|
427
|
+
```python
|
|
428
|
+
{
|
|
429
|
+
# 状态码
|
|
430
|
+
"code": 0,
|
|
431
|
+
# 提示信息
|
|
432
|
+
"message": "success",
|
|
433
|
+
# 错误信息
|
|
434
|
+
"errors": [],
|
|
435
|
+
# 请求ID
|
|
436
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
437
|
+
# 响应时间
|
|
438
|
+
"response_time": "2025-08-13 19:23:04",
|
|
439
|
+
# 响应数据量
|
|
440
|
+
"response_count": 2,
|
|
441
|
+
# 总数据量
|
|
442
|
+
"total_count": 2,
|
|
443
|
+
# 响应数据
|
|
444
|
+
"data": [
|
|
445
|
+
{
|
|
446
|
+
# 领星店铺ID
|
|
447
|
+
"sid": 9857,
|
|
448
|
+
# 亚马逊订单编号 [原字段 'order_id']
|
|
449
|
+
"amazon_order_id": "113-*******-*******",
|
|
450
|
+
# 亚马逊配送中心代码
|
|
451
|
+
"fulfillment_center_id": "PCW1",
|
|
452
|
+
# 退货商品ASIN
|
|
453
|
+
"asin": "B0D*******",
|
|
454
|
+
# 退货亚马逊SKU [原字段 'sku']
|
|
455
|
+
"msku": "SKU*********",
|
|
456
|
+
# 退货领星本地SKU [原字段 'local_sku']
|
|
457
|
+
"lsku": "LOCAL********",
|
|
458
|
+
# 退货亚马逊FNSKU
|
|
459
|
+
"fnsku": "X00*******",
|
|
460
|
+
# 退货商品标题 [原字段 'product_name']
|
|
461
|
+
"title": "Product Title",
|
|
462
|
+
# 退货商品数量 [原字段 'quantity']
|
|
463
|
+
"return_qty": 1,
|
|
464
|
+
# 退货状态 [原字段 'status']
|
|
465
|
+
"return_status": "Unit returned to inventory",
|
|
466
|
+
# 退货原因 [原字段 'reason']
|
|
467
|
+
"return_reason": "UNDELIVERABLE_UNKNOWN",
|
|
468
|
+
# 退货备注 [原字段 'remark']
|
|
469
|
+
"return_note": "",
|
|
470
|
+
# 退货处置结果 [原字段 'detailed_disposition']
|
|
471
|
+
"disposition": "SELLABLE",
|
|
472
|
+
# LNP编码号 [原字段 'license_plate_number']
|
|
473
|
+
"lpn_number": "LPN***********",
|
|
474
|
+
# 买家评论
|
|
475
|
+
"customer_comments": "",
|
|
476
|
+
# 订单购买时间 (UTC时间) [原字段 'purchase_date']
|
|
477
|
+
"purchase_time_utc": "2025-07-09T21:54:01Z",
|
|
478
|
+
# 订单购买日期 (本地日期) [原字段 'purchase_date_locale']
|
|
479
|
+
"purchase_date_loc": "2025-07-09",
|
|
480
|
+
# 退货时间 (UTC时间) [原字段 'return_date']
|
|
481
|
+
"return_time_utc": "2025-08-07T01:57:29+01:00",
|
|
482
|
+
# 退货日期 (本地日期) [原字段 'return_date_locale']
|
|
483
|
+
"return_date_loc": "2025-08-06",
|
|
484
|
+
# 数据最后修改时间 (北京时间) [原字段 'gmt_modified']
|
|
485
|
+
"update_time_cnt": "2025-08-07 13:04:59",
|
|
486
|
+
# 退货标签 [原字段 'tag']
|
|
487
|
+
"tags": [
|
|
488
|
+
{
|
|
489
|
+
# 标签名称
|
|
490
|
+
"tag_name": "尺码问题",
|
|
491
|
+
# 标签颜色
|
|
492
|
+
"tag_color": "#FF0000",
|
|
493
|
+
},
|
|
494
|
+
...
|
|
495
|
+
],
|
|
496
|
+
},
|
|
497
|
+
...
|
|
498
|
+
],
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
"""
|
|
502
|
+
url = route.FBA_RETURN_ORDERS
|
|
503
|
+
# 解析并验证参数
|
|
504
|
+
args = {
|
|
505
|
+
"sid": sid,
|
|
506
|
+
"start_date": start_date,
|
|
507
|
+
"end_date": end_date,
|
|
508
|
+
"date_type": date_type,
|
|
509
|
+
"offset": offset,
|
|
510
|
+
"length": length,
|
|
511
|
+
}
|
|
512
|
+
try:
|
|
513
|
+
p = param.Orders.model_validate(args)
|
|
514
|
+
except Exception as err:
|
|
515
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
516
|
+
|
|
517
|
+
# 发送请求
|
|
518
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
519
|
+
return schema.FbaReturnOrders.model_validate(data)
|
|
520
|
+
|
|
521
|
+
async def FbaShipments(
|
|
522
|
+
self,
|
|
523
|
+
sid: int,
|
|
524
|
+
start_time: str | datetime.date | datetime.datetime,
|
|
525
|
+
end_time: str | datetime.date | datetime.datetime,
|
|
526
|
+
*,
|
|
527
|
+
offset: int | None = None,
|
|
528
|
+
length: int | None = None,
|
|
529
|
+
) -> schema.FbaShipments:
|
|
530
|
+
"""查询亚马逊FBA发货源订单
|
|
531
|
+
|
|
532
|
+
## Docs
|
|
533
|
+
- 亚马逊源表数据: [查询亚马逊源报表—Amazon Fulfilled Shipments v1](https://apidoc.lingxing.com/#/docs/SourceData/v1getAmazonFulfilledShipmentsList)
|
|
534
|
+
- 对应亚马逊 'Amazon Fulfilled Shipments' 源报告
|
|
535
|
+
|
|
536
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
537
|
+
:param start_time `<'str/date/datetime'>`: 查询发货开始时间 `shipment_time_loc`
|
|
538
|
+
:param end_time `<'str/date/datetime'>`: 查询发货结束时间 `shipment_time_loc`
|
|
539
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
540
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
541
|
+
:returns `<'FbaShipments'>`: 返回查询到的亚马逊FBA发货源订单结果
|
|
542
|
+
```python
|
|
543
|
+
{
|
|
544
|
+
# 状态码
|
|
545
|
+
"code": 0,
|
|
546
|
+
# 提示信息
|
|
547
|
+
"message": "success",
|
|
548
|
+
# 错误信息
|
|
549
|
+
"errors": [],
|
|
550
|
+
# 请求ID
|
|
551
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
552
|
+
# 响应时间
|
|
553
|
+
"response_time": "2025-08-13 19:23:04",
|
|
554
|
+
# 响应数据量
|
|
555
|
+
"response_count": 2,
|
|
556
|
+
# 总数据量
|
|
557
|
+
"total_count": 2,
|
|
558
|
+
# 响应数据
|
|
559
|
+
"data": [
|
|
560
|
+
{
|
|
561
|
+
# 领星店铺ID
|
|
562
|
+
"sid": 1,
|
|
563
|
+
# 亚马逊订单编号
|
|
564
|
+
"amazon_order_id": "114-*******-*******",
|
|
565
|
+
# 亚马逊订单商品编号
|
|
566
|
+
"amazon_order_item_id": "1373***********",
|
|
567
|
+
# 商家订单编号
|
|
568
|
+
"merchant_order_id": "",
|
|
569
|
+
# 商家订单商品编号
|
|
570
|
+
"merchant_order_item_id": "",
|
|
571
|
+
# 销售渠道 (如: "amazon.com")
|
|
572
|
+
"sales_channel": "amazon.com",
|
|
573
|
+
# 配送方式 (AFN 或 MFN)
|
|
574
|
+
"fulfillment_channel": "AFN",
|
|
575
|
+
# 亚马逊配送中心代码
|
|
576
|
+
"fulfillment_center_id": "AFW1",
|
|
577
|
+
# 亚马逊货件编号
|
|
578
|
+
"shipment_id": "BB3******",
|
|
579
|
+
# 亚马逊货件商品编号
|
|
580
|
+
"shipment_item_id": "D0k**********",
|
|
581
|
+
# 订单配送服务级别 [原字段 'ship_service_level']
|
|
582
|
+
"shipment_service": "Expedited",
|
|
583
|
+
# 承运商代码 [原字段 'carrier']
|
|
584
|
+
"shipment_carrier": "AMZN_US",
|
|
585
|
+
# 追踪单号
|
|
586
|
+
"tracking_number": "TBA3***********",
|
|
587
|
+
# 亚马逊SKU
|
|
588
|
+
"msku": "SKU*********",
|
|
589
|
+
# 领星本地SKU [原字段 'local_sku']
|
|
590
|
+
"lsku": "LOCAL********",
|
|
591
|
+
# 领星产品名称 [原字段 'local_name']
|
|
592
|
+
"product_name": "JBL",
|
|
593
|
+
# 商品标题 [原字段 'product_name']
|
|
594
|
+
"title": "Product Title",
|
|
595
|
+
# 发货商品数量 [原字段 'quantity_shipped']
|
|
596
|
+
"shipped_qty": 1,
|
|
597
|
+
# 商品销售金额 [原字段 'item_price']
|
|
598
|
+
"sales_amt": 27.98,
|
|
599
|
+
# 商品销售金额税费 [原字段 'item_tax']
|
|
600
|
+
"sales_tax_amt": 1.89,
|
|
601
|
+
# 买家支付运费金额 [原字段 'shipping_price']
|
|
602
|
+
"shipping_credits_amt": 0.0,
|
|
603
|
+
# 买家支付运费税费 [原字段 'shipping_tax']
|
|
604
|
+
"shipping_credits_tax_amt": 0.0,
|
|
605
|
+
# 买家支付礼品包装费金额 [原字段 'gift_wrap_price']
|
|
606
|
+
"giftwrap_credits_amt": 0.0,
|
|
607
|
+
# 买家支付礼品包装费税费 [原字段 'gift_wrap_tax']
|
|
608
|
+
"giftwrap_credits_tax_amt": 0.0,
|
|
609
|
+
# 卖家商品促销折扣金额 [原字段 'item_promotion_discount']
|
|
610
|
+
"promotion_discount_amt": 0.0,
|
|
611
|
+
# 卖家商品运费折扣金额 [原字段 'ship_promotion_discount']
|
|
612
|
+
"shipping_discount_amt": 0.0,
|
|
613
|
+
# 亚马逊积分抵付款金额 (日本站) [原字段 'points_granted']
|
|
614
|
+
"points_discount_amt": 0.0,
|
|
615
|
+
# 货币代码 [原字段 'currency']
|
|
616
|
+
"currency_code": "USD",
|
|
617
|
+
# 买家国家代码 [原字段 'ship_country']
|
|
618
|
+
"buyer_country_code": "US",
|
|
619
|
+
# 买家州/省 [原字段 'ship_state']
|
|
620
|
+
"buyer_state": "TX",
|
|
621
|
+
# 买家城市 [原字段 'ship_city']
|
|
622
|
+
"buyer_city": "KENDALIA",
|
|
623
|
+
# 买家地址1 [原字段 'ship_address_1']
|
|
624
|
+
"buyer_address1": "",
|
|
625
|
+
# 买家地址2 [原字段 'ship_address_2']
|
|
626
|
+
"buyer_address2": "",
|
|
627
|
+
# 买家地址3 [原字段 'ship_address_3']
|
|
628
|
+
"buyer_address3": "",
|
|
629
|
+
# 买家邮编 [原字段 'ship_postal_code']
|
|
630
|
+
"buyer_postcode": "78027-1803",
|
|
631
|
+
# 买家名称
|
|
632
|
+
"buyer_name": "",
|
|
633
|
+
# 买家邮箱
|
|
634
|
+
"buyer_email": "b589v2l553nyyh2@marketplace.amazon.com",
|
|
635
|
+
# 买家电话 [原字段 'buyer_phone_number']
|
|
636
|
+
"buyer_phone": "",
|
|
637
|
+
# 收件人名称
|
|
638
|
+
"recipient_name": "",
|
|
639
|
+
# 账单国家代码 [原字段 'bill_country']
|
|
640
|
+
"billing_country_code": "",
|
|
641
|
+
# 账单州/省 [原字段 'bill_state']
|
|
642
|
+
"billing_state": "",
|
|
643
|
+
# 账单城市 [原字段 'bill_city']
|
|
644
|
+
"billing_city": "",
|
|
645
|
+
# 账单地址1 [原字段 'bill_address_1']
|
|
646
|
+
"billing_address1": "",
|
|
647
|
+
# 账单地址2 [原字段 'bill_address_2']
|
|
648
|
+
"billing_address2": "",
|
|
649
|
+
# 账单地址3 [原字段 'bill_address_3']
|
|
650
|
+
"billing_address3": "",
|
|
651
|
+
# 账单邮编 [原字段 'bill_postal_code']
|
|
652
|
+
"billing_postcode": "",
|
|
653
|
+
# 订单购买时间 (UTC时间) [原字段 'purchase_date']
|
|
654
|
+
"purchase_time_utc": "2025-08-25T18:21:12+00:00",
|
|
655
|
+
# 订单购买日期 (本地时间) [原字段 'purchase_date_locale']
|
|
656
|
+
"purchase_time_loc": "2025-08-25T11:21:12-07:00",
|
|
657
|
+
# 订单付款时间 (UTC时间) [原字段 'payments_date']
|
|
658
|
+
"payments_time_utc": "2025-08-26T04:20:05+00:00",
|
|
659
|
+
# 订单付款时间 (本地时间) [原字段 'payments_date_locale']
|
|
660
|
+
"payments_time_loc": "2025-08-25T21:20:05-07:00",
|
|
661
|
+
# 订单发货时间 (UTC时间) [原字段 'shipment_date']
|
|
662
|
+
"shipment_time_utc": "2025-08-26T04:20:05+00:00",
|
|
663
|
+
# 订单发货时间 (本地时间) [原字段 'shipment_date_locale']
|
|
664
|
+
"shipment_time_loc": "2025-08-25T21:20:05-07:00",
|
|
665
|
+
# 预计送达时间 (UTC时间) [原字段 'estimated_arrival_date']
|
|
666
|
+
"estimated_arrival_time_utc": "2025-08-27T03:00:00+00:00",
|
|
667
|
+
# 预计送达日期 (本地日期) [原字段 'estimated_arrival_date_locale']
|
|
668
|
+
"estimated_arrival_date_loc": "2025-08-26",
|
|
669
|
+
# 报告数据时间 (UTC时间) [原字段 'reporting_date']
|
|
670
|
+
"report_time_utc": "2025-08-26T07:20:13+00:00",
|
|
671
|
+
# 报告数据时间 (本地时间) [原字段 'reporting_date_locale']
|
|
672
|
+
"report_time_loc": "2025-08-26T00:20:13-07:00",
|
|
673
|
+
},
|
|
674
|
+
...
|
|
675
|
+
],
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
"""
|
|
679
|
+
url = route.FBA_SHIPMENTS_V1
|
|
680
|
+
# 解析并验证参数
|
|
681
|
+
args = {
|
|
682
|
+
"sid": sid,
|
|
683
|
+
"start_time": start_time,
|
|
684
|
+
"end_time": end_time,
|
|
685
|
+
"offset": offset,
|
|
686
|
+
"length": length,
|
|
687
|
+
}
|
|
688
|
+
try:
|
|
689
|
+
p = param.FbaShipments.model_validate(args)
|
|
690
|
+
except Exception as err:
|
|
691
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
692
|
+
|
|
693
|
+
# 发送请求
|
|
694
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
695
|
+
return schema.FbaShipments.model_validate(data)
|
|
696
|
+
|
|
697
|
+
async def FbmReturnOrders(
|
|
698
|
+
self,
|
|
699
|
+
sid: int,
|
|
700
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
701
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
702
|
+
*,
|
|
703
|
+
date_type: int | None = None,
|
|
704
|
+
offset: int | None = None,
|
|
705
|
+
length: int | None = None,
|
|
706
|
+
) -> schema.FbmReturnOrders:
|
|
707
|
+
"""查询亚马逊FBM退货源订单
|
|
708
|
+
|
|
709
|
+
## Docs
|
|
710
|
+
- 亚马逊源表数据: [查询亚马逊源报表-FBM退货订单](https://apidoc.lingxing.com/#/docs/SourceData/fbmReturnOrderList)
|
|
711
|
+
- 对应亚马逊 'Returns Report' 源报告
|
|
712
|
+
|
|
713
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
714
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
715
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
716
|
+
:param date_type `<'int/None'>`: 日期类型, 默认 `None` (使用: 1)
|
|
717
|
+
|
|
718
|
+
- `1`: 退货日期
|
|
719
|
+
- `2`: 下单日期
|
|
720
|
+
|
|
721
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
722
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
723
|
+
:returns `<'FbmReturnOrders'>`: 返回查询到的亚马逊FBM退货源订单结果
|
|
724
|
+
```python
|
|
725
|
+
{
|
|
726
|
+
# 状态码
|
|
727
|
+
"code": 0,
|
|
728
|
+
# 提示信息
|
|
729
|
+
"message": "success",
|
|
730
|
+
# 错误信息
|
|
731
|
+
"errors": [],
|
|
732
|
+
# 请求ID
|
|
733
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
734
|
+
# 响应时间
|
|
735
|
+
"response_time": "2025-08-13 19:23:04",
|
|
736
|
+
# 响应数据量
|
|
737
|
+
"response_count": 2,
|
|
738
|
+
# 总数据量
|
|
739
|
+
"total_count": 2,
|
|
740
|
+
# 响应数据
|
|
741
|
+
"data": [
|
|
742
|
+
{
|
|
743
|
+
# 领星店铺ID
|
|
744
|
+
"sid": 1,
|
|
745
|
+
# 领星店铺名称
|
|
746
|
+
"seller_name": "Store-UK",
|
|
747
|
+
# 国家 (中文)
|
|
748
|
+
"country": "英国",
|
|
749
|
+
# 订单唯一哈希值 (不是唯一键)
|
|
750
|
+
"order_hash": "ae6ab186************************",
|
|
751
|
+
# 亚马逊订单编号 [原字段 'order_id']
|
|
752
|
+
"amazon_order_id": "205-*******-*******",
|
|
753
|
+
# 商品ASIN
|
|
754
|
+
"asin": "B0C*******",
|
|
755
|
+
# 亚马逊SKU [原字段 'seller_sku']
|
|
756
|
+
"msku": "SKU*********",
|
|
757
|
+
# 领星本地SKU [原字段 'local_sku']
|
|
758
|
+
"lsku": "LOCAL********",
|
|
759
|
+
# 领星产品名称 [原字段 'local_name']
|
|
760
|
+
"product_name": "JBL",
|
|
761
|
+
# 品牌名称 [原字段 'brand_title']
|
|
762
|
+
"brand": "FastTech",
|
|
763
|
+
# 商品标题 [原字段 'item_name']
|
|
764
|
+
"title": "Product Title",
|
|
765
|
+
# 商品类目 [原字段 'category_title_path']
|
|
766
|
+
"category": "",
|
|
767
|
+
# 商品 ASIN 链接
|
|
768
|
+
"asin_url": "https://www.amazon.co.uk/dp/B0C*******",
|
|
769
|
+
# 商品图片链接 [原字段 'pic_url']
|
|
770
|
+
"image_url": "https://image.distributetop.com/****.jpg",
|
|
771
|
+
# 货币代码
|
|
772
|
+
"currency_code": "",
|
|
773
|
+
# 订单商品销售金额 [原字段 'order_amount']
|
|
774
|
+
"order_amt": 35.57,
|
|
775
|
+
# 订单商品退款金额 [原字段 'refunded_amount']
|
|
776
|
+
"refund_amt": 0.0,
|
|
777
|
+
# 订单商品数量 [原字段 'order_quantity']
|
|
778
|
+
"order_qty": 1,
|
|
779
|
+
# 退货商品数量 [原字段 'return_quantity']
|
|
780
|
+
"return_qty": 1,
|
|
781
|
+
# 退货状态
|
|
782
|
+
"return_status": "Approved",
|
|
783
|
+
# 退货类型
|
|
784
|
+
"return_type": "C-Returns",
|
|
785
|
+
# 退货原因
|
|
786
|
+
"return_reason": "CR-NO_REASON_GIVEN(客户退货-未提供原因)",
|
|
787
|
+
# 退货解决方案 [原字段 'resolution']
|
|
788
|
+
"return_resolution": "StandardRefund",
|
|
789
|
+
# 退货备注 [原字段 'remark']
|
|
790
|
+
"return_note": "",
|
|
791
|
+
# 退货RMA编号 [原字段 'rma_id']
|
|
792
|
+
"rma_number": "DdVn6hR1RRMA",
|
|
793
|
+
# 退货RMA提供者 [原字段 'rma_id_provider']
|
|
794
|
+
"rma_provider": "",
|
|
795
|
+
# 退货承运商 [原字段 'return_carrier']
|
|
796
|
+
"carrier": "",
|
|
797
|
+
# 退货追踪单号 [原字段 'tracking_id']
|
|
798
|
+
"tracking_number": "",
|
|
799
|
+
# 发票编号
|
|
800
|
+
"invoice_number": "",
|
|
801
|
+
# 物流标签类型
|
|
802
|
+
"label_type": "AmazonUnPaidLabel",
|
|
803
|
+
# 物流标签费用
|
|
804
|
+
"label_cost": 0.0,
|
|
805
|
+
# 物流标签费用支付方
|
|
806
|
+
"label_payer": "Customer",
|
|
807
|
+
# 是否为Prime订单 (N: No, Y: Yes)
|
|
808
|
+
"is_prime": "N",
|
|
809
|
+
# 是否在退货政策内 (N: No, Y: Yes) [原字段 'in_policy']
|
|
810
|
+
"is_within_policy": "Y",
|
|
811
|
+
# 是否是A-to-Z索赔订单 (N: No, Y: Yes) [原字段 'a_to_z_claim']
|
|
812
|
+
"is_a_to_z_claim": "N",
|
|
813
|
+
# Safe-T索赔ID
|
|
814
|
+
"safet_claim_id": "",
|
|
815
|
+
# Safe-T索赔原因 [原字段 'safet_action_reason']
|
|
816
|
+
"safet_claim_reason": "",
|
|
817
|
+
# Safe-T索赔状态
|
|
818
|
+
"safet_claim_state": "",
|
|
819
|
+
# Safe-T索赔赔付金额 [原字段 'safet_claim_reimbursement_amount']
|
|
820
|
+
"safet_claim_reimbursement_amt": 0.0,
|
|
821
|
+
# Safe-T索赔时间 [原字段 'safet_claim_creation_time']
|
|
822
|
+
"safet_claim_time": "",
|
|
823
|
+
# 购买日期
|
|
824
|
+
"order_date": "2024-07-27",
|
|
825
|
+
# 退货日期
|
|
826
|
+
"return_date": "2024-08-12",
|
|
827
|
+
# 退货送达日期
|
|
828
|
+
"return_delivery_date": "2024-08-14",
|
|
829
|
+
# 数据同步时间 (时间戳) [原字段 'sync_time']
|
|
830
|
+
"sync_time_ts": 0,
|
|
831
|
+
# 退货标签 [原字段 'tag_type_ids']
|
|
832
|
+
"tags": [
|
|
833
|
+
{
|
|
834
|
+
# 标签名称
|
|
835
|
+
"tag_name": "尺码问题",
|
|
836
|
+
# 标签颜色
|
|
837
|
+
"tag_color": "#FF0000",
|
|
838
|
+
},
|
|
839
|
+
...
|
|
840
|
+
],
|
|
841
|
+
},
|
|
842
|
+
...
|
|
843
|
+
],
|
|
844
|
+
}
|
|
845
|
+
```
|
|
846
|
+
"""
|
|
847
|
+
url = route.FBM_RETURN_ORDERS
|
|
848
|
+
# 解析并验证参数
|
|
849
|
+
args = {
|
|
850
|
+
"sid": sid,
|
|
851
|
+
"start_date": start_date,
|
|
852
|
+
"end_date": end_date,
|
|
853
|
+
"date_type": date_type,
|
|
854
|
+
"offset": offset,
|
|
855
|
+
"length": length,
|
|
856
|
+
}
|
|
857
|
+
try:
|
|
858
|
+
p = param.Orders.model_validate(args)
|
|
859
|
+
except Exception as err:
|
|
860
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
861
|
+
|
|
862
|
+
# 发送请求
|
|
863
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
864
|
+
return schema.FbmReturnOrders.model_validate(data)
|
|
865
|
+
|
|
866
|
+
# FBA 库存数据 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
867
|
+
async def FbaRemovalOrders(
|
|
868
|
+
self,
|
|
869
|
+
sid: int,
|
|
870
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
871
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
872
|
+
*,
|
|
873
|
+
date_type: ORDER_DATE_TYPE = "update_date",
|
|
874
|
+
offset: int | None = None,
|
|
875
|
+
length: int | None = None,
|
|
876
|
+
) -> schema.FbaRemovalOrders:
|
|
877
|
+
"""查询亚马逊FBA移除订单
|
|
878
|
+
|
|
879
|
+
## Docs
|
|
880
|
+
- 亚马逊源表数据: [查询亚马逊源报表-移除订单(新)](https://apidoc.lingxing.com/#/docs/SourceData/RemovalOrderListNew)
|
|
881
|
+
- 对应亚马逊 'Fulfillment-Removal Order Detail' 源报告
|
|
882
|
+
|
|
883
|
+
## Notice
|
|
884
|
+
- 报告为 seller_id 维度, 请求会返回 sid 对应 seller_id 下所有移除订单数据
|
|
885
|
+
- 同一个 seller_id 授权的店铺任取一个 sid 请求报告数据即可
|
|
886
|
+
|
|
887
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
888
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
889
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
890
|
+
:param date_type `<'str/None'>`: 日期类型, 默认 `"update_date"`
|
|
891
|
+
|
|
892
|
+
- `'update_date'`: 数据更新日期
|
|
893
|
+
- `'request_date'`: 移除请求日期
|
|
894
|
+
|
|
895
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
896
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
897
|
+
:returns `<'FbaRemovalOrders'>`: 返回查询到的亚马逊FBA移除订单结果
|
|
898
|
+
```python
|
|
899
|
+
{
|
|
900
|
+
# 状态码
|
|
901
|
+
"code": 0,
|
|
902
|
+
# 提示信息
|
|
903
|
+
"message": "success",
|
|
904
|
+
# 错误信息
|
|
905
|
+
"errors": [],
|
|
906
|
+
# 请求ID
|
|
907
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
908
|
+
# 响应时间
|
|
909
|
+
"response_time": "2025-08-13 19:23:04",
|
|
910
|
+
# 响应数据量
|
|
911
|
+
"response_count": 2,
|
|
912
|
+
# 总数据量
|
|
913
|
+
"total_count": 2,
|
|
914
|
+
# 响应数据
|
|
915
|
+
"data": [
|
|
916
|
+
{
|
|
917
|
+
# 领星店铺ID
|
|
918
|
+
"sid": 1,
|
|
919
|
+
# 亚马逊卖家ID
|
|
920
|
+
"seller_id": "AVI**********",
|
|
921
|
+
# 站点区域
|
|
922
|
+
"region": "na",
|
|
923
|
+
# 站点国家代码
|
|
924
|
+
"country_code": "US",
|
|
925
|
+
# 移除订单编号 [原字段 'order_id']
|
|
926
|
+
"removal_order_id": "IJW*******",
|
|
927
|
+
# 移除订单类型 (Return 或 Disposal) [原字段 'order_type']
|
|
928
|
+
"removal_order_type": "Return",
|
|
929
|
+
# 移除订单状态 [原字段 'order_status']
|
|
930
|
+
"removal_order_status": "Completed",
|
|
931
|
+
# 亚马逊SKU [原字段 'sku']
|
|
932
|
+
"msku": "SKU*********",
|
|
933
|
+
# 领星本地SKU [原字段 'local_sku']
|
|
934
|
+
"lsku": "LOCAL********",
|
|
935
|
+
# 亚马逊FNSKU
|
|
936
|
+
"fnsku": "X00*******",
|
|
937
|
+
# 领星产品名称 [原字段 'local_name']
|
|
938
|
+
"product_name": "JBL",
|
|
939
|
+
# 库存处置结果
|
|
940
|
+
"disposition": "Unsellable",
|
|
941
|
+
# 移除商品请求数量 [原字段 'requested_quantity']
|
|
942
|
+
"requested_qty": 5,
|
|
943
|
+
# 取消移除商品数量 [原字段 'cancelled_quantity']
|
|
944
|
+
"cancelled_qty": 0,
|
|
945
|
+
# 移除处理中商品数量 [原字段 'in_process_quantity']
|
|
946
|
+
"processing_qty": 0,
|
|
947
|
+
# 已处置商品数量 [原字段 'disposed_quantity']
|
|
948
|
+
"disposed_qty": 0,
|
|
949
|
+
# 已发货商品数量 [原字段 'shipped_quantity']
|
|
950
|
+
"shipped_qty": 5,
|
|
951
|
+
# 移除商品费用
|
|
952
|
+
"removal_fee": 5.2,
|
|
953
|
+
# 货币代码 [原字段 'currency']
|
|
954
|
+
"currency_code": "USD",
|
|
955
|
+
# 收件地址 [原字段 'address_detail']
|
|
956
|
+
"ship_to_address": "Y10062,85756,7480 E Sycamore Park Blvd Tucson,AZ,美国",
|
|
957
|
+
# 移除请求时间 [原字段 'request_date']
|
|
958
|
+
"request_time": "2025-07-28T12:39:45-03:00",
|
|
959
|
+
# 数据更新时间 [原字段 'last_updated_date']
|
|
960
|
+
"update_time": "2025-08-11T20:31:38-03:00",
|
|
961
|
+
},
|
|
962
|
+
...
|
|
963
|
+
]
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
"""
|
|
967
|
+
url = route.FBA_REMOVAL_ORDERS
|
|
968
|
+
# 解析并验证参数
|
|
969
|
+
args = {
|
|
970
|
+
"sid": sid,
|
|
971
|
+
"start_date": start_date,
|
|
972
|
+
"end_date": end_date,
|
|
973
|
+
"date_type": date_type,
|
|
974
|
+
"offset": offset,
|
|
975
|
+
"length": length,
|
|
976
|
+
}
|
|
977
|
+
try:
|
|
978
|
+
p = param.FbaRemovalOrders.model_validate(args)
|
|
979
|
+
except Exception as err:
|
|
980
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
981
|
+
|
|
982
|
+
# 发送请求
|
|
983
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
984
|
+
return schema.FbaRemovalOrders.model_validate(data)
|
|
985
|
+
|
|
986
|
+
async def FbaRemovalShipments(
|
|
987
|
+
self,
|
|
988
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
989
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
990
|
+
*,
|
|
991
|
+
sid: int | None = None,
|
|
992
|
+
seller_id: str | None = None,
|
|
993
|
+
offset: int | None = None,
|
|
994
|
+
length: int | None = None,
|
|
995
|
+
) -> schema.FbaRemovalShipments:
|
|
996
|
+
"""查询亚马逊FBA移除货件
|
|
997
|
+
|
|
998
|
+
## Docs
|
|
999
|
+
- 亚马逊源表数据: [查询亚马逊源报表-移除货件(新)](https://apidoc.lingxing.com/#/docs/SourceData/RemovalShipmentList)
|
|
1000
|
+
- 对应亚马逊 'Fulfillment-Removal Shipment Detail' 源报告
|
|
1001
|
+
|
|
1002
|
+
## Notice
|
|
1003
|
+
- 参数 sid 和 seller_id 为可选参数, 若不传入, 则返回所有授权 seller_id 下的移除货件数据
|
|
1004
|
+
- 报告为 seller_id 维度, 若按 sid 请求则返回对应 seller_id 下所有移除货件数据
|
|
1005
|
+
- 同一个 seller_id 授权的店铺任取一个 sid 请求报告数据即可
|
|
1006
|
+
|
|
1007
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
1008
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
1009
|
+
:param sid `<'int/None'>`: 领星店铺ID, 默认 `None`
|
|
1010
|
+
:param seller_id `<'str/None'>`: 亚马逊卖家ID, 默认 `None`
|
|
1011
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1012
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
1013
|
+
:returns `<'FbaRemovalShipments'>`: 返回查询到的亚马逊FBA移除货件结果
|
|
1014
|
+
```python
|
|
1015
|
+
{
|
|
1016
|
+
# 状态码
|
|
1017
|
+
"code": 0,
|
|
1018
|
+
# 提示信息
|
|
1019
|
+
"message": "success",
|
|
1020
|
+
# 错误信息
|
|
1021
|
+
"errors": [],
|
|
1022
|
+
# 请求ID
|
|
1023
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1024
|
+
# 响应时间
|
|
1025
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1026
|
+
# 响应数据量
|
|
1027
|
+
"response_count": 2,
|
|
1028
|
+
# 总数据量
|
|
1029
|
+
"total_count": 2,
|
|
1030
|
+
# 响应数据
|
|
1031
|
+
data: [
|
|
1032
|
+
{
|
|
1033
|
+
# 领星站点ID
|
|
1034
|
+
"mid": 1,
|
|
1035
|
+
# 领星店铺ID
|
|
1036
|
+
"sid": 1,
|
|
1037
|
+
# 站点国家 (中文) [原字段 'marketplace']
|
|
1038
|
+
"country": "美国",
|
|
1039
|
+
# 亚马逊卖家ID
|
|
1040
|
+
"seller_id": "AVI**********",
|
|
1041
|
+
# 领星店铺帐号名称
|
|
1042
|
+
"seller_account_name": "Store-NA",
|
|
1043
|
+
# 店铺信息列表 [原字段 'seller_name']
|
|
1044
|
+
"sellers": [
|
|
1045
|
+
{
|
|
1046
|
+
# 领星站点ID
|
|
1047
|
+
"mid": 1,
|
|
1048
|
+
# 领星店铺ID
|
|
1049
|
+
"sid": 1,
|
|
1050
|
+
# 领星店铺名称 [原字段 'name']
|
|
1051
|
+
"seller_name": "Store-NA-US",
|
|
1052
|
+
# 站点国家 (中文) [原字段 'marketplace']
|
|
1053
|
+
"country": "美国"
|
|
1054
|
+
},
|
|
1055
|
+
...
|
|
1056
|
+
],
|
|
1057
|
+
# 移除业务标识 (唯一移除货件行) [原字段 'uuid_new']
|
|
1058
|
+
"uuid": "a644f4d*************************",
|
|
1059
|
+
# 移除业务标识序号 [原字段 'uuid_num_new']
|
|
1060
|
+
"uuid_seq": 1,
|
|
1061
|
+
# 移除货件ID [原字段 'order_id']
|
|
1062
|
+
"removal_shipment_id": "nIU*******",
|
|
1063
|
+
# 移除货件类型 [原字段 'removal_order_type']
|
|
1064
|
+
"removal_shipment_type": "Return",
|
|
1065
|
+
# 亚马逊SKU [原字段 'sku']
|
|
1066
|
+
"msku": "SKU*********",
|
|
1067
|
+
# 亚马逊FNSKU
|
|
1068
|
+
"fnsku": "X00*******",
|
|
1069
|
+
# 商品信息列表 [原字段 'local_info']
|
|
1070
|
+
"products": [
|
|
1071
|
+
{
|
|
1072
|
+
# 领星本地SKU [原字段 'local_sku']
|
|
1073
|
+
"lsku": "LOCAL********",
|
|
1074
|
+
# 领星产品名称 [原字段 'local_name']
|
|
1075
|
+
"product_name": "JBL",
|
|
1076
|
+
},
|
|
1077
|
+
...
|
|
1078
|
+
],
|
|
1079
|
+
# 库存处置结果
|
|
1080
|
+
"disposition": "Unsellable",
|
|
1081
|
+
# 已发货商品数量 [原字段 'shipped_quantity']
|
|
1082
|
+
"shipped_qty": 1,
|
|
1083
|
+
# 货件成运商
|
|
1084
|
+
"carrier": "UPS_GR_PL",
|
|
1085
|
+
# 货件追踪单号
|
|
1086
|
+
"tracking_number": "1ZA8**************",
|
|
1087
|
+
# 移除货件的仓库入库单号 [原字段 'overseas_removal_order_no']
|
|
1088
|
+
"warehouse_inbound_number": "OWR25**********",
|
|
1089
|
+
# 移除货件收货地址 [原字段 'delivery_info']
|
|
1090
|
+
"ship_to_address": {
|
|
1091
|
+
# 国家代码 [原字段 'ship_country']
|
|
1092
|
+
"country_code": "US",
|
|
1093
|
+
# 州/省 [原字段 'ship_state']
|
|
1094
|
+
"state": "AZ",
|
|
1095
|
+
# 城市 [原字段 'ship_city']
|
|
1096
|
+
"city": "Tucson",
|
|
1097
|
+
# 县/郡
|
|
1098
|
+
"county": "",
|
|
1099
|
+
# 区/镇
|
|
1100
|
+
"district": "",
|
|
1101
|
+
# 详细地址
|
|
1102
|
+
"address": "Y10062,85756,7480 E Sycamore Park Blvd,Tucson,AZ,US 美国",
|
|
1103
|
+
# 地址行1
|
|
1104
|
+
"address_line1": "7480 E Sycamore Park Blvd",
|
|
1105
|
+
# 地址行2
|
|
1106
|
+
"address_line2": "",
|
|
1107
|
+
# 地址行3
|
|
1108
|
+
"address_line3": "",
|
|
1109
|
+
# 邮编 [原字段 'ship_postal_code']
|
|
1110
|
+
"postcode": "85756",
|
|
1111
|
+
# 收件人名称
|
|
1112
|
+
"name": "Y10062",
|
|
1113
|
+
# 收件人电话
|
|
1114
|
+
"phone": "",
|
|
1115
|
+
},
|
|
1116
|
+
# 移除请求时间 [原字段 'request_date']
|
|
1117
|
+
"request_time": "2025-07-08T07:36:15-07:00",
|
|
1118
|
+
# 移除发货时间 [原字段 'shipment_date']
|
|
1119
|
+
"shipment_time": "2025-08-06T09:27:38-07:00",
|
|
1120
|
+
# 移除发货时间 (时间戳) [原字段 'shipment_date_timestamp']
|
|
1121
|
+
"shipment_time_ts": 1754497658,
|
|
1122
|
+
},
|
|
1123
|
+
...
|
|
1124
|
+
],
|
|
1125
|
+
}
|
|
1126
|
+
```
|
|
1127
|
+
"""
|
|
1128
|
+
url = route.FBA_REMOVAL_SHIPMENTS
|
|
1129
|
+
# 解析并验证参数
|
|
1130
|
+
args = {
|
|
1131
|
+
"start_date": start_date,
|
|
1132
|
+
"end_date": end_date,
|
|
1133
|
+
"sid": sid,
|
|
1134
|
+
"seller_id": seller_id,
|
|
1135
|
+
"offset": offset,
|
|
1136
|
+
"length": length,
|
|
1137
|
+
}
|
|
1138
|
+
try:
|
|
1139
|
+
p = param.FbaRemovalShipments.model_validate(args)
|
|
1140
|
+
except Exception as err:
|
|
1141
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1142
|
+
|
|
1143
|
+
# 发送请求
|
|
1144
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1145
|
+
return schema.FbaRemovalShipments.model_validate(data)
|
|
1146
|
+
|
|
1147
|
+
async def FbaInventory(
|
|
1148
|
+
self,
|
|
1149
|
+
sid: int,
|
|
1150
|
+
*,
|
|
1151
|
+
offset: int | None = None,
|
|
1152
|
+
length: int | None = None,
|
|
1153
|
+
) -> schema.FbaInventory:
|
|
1154
|
+
"""查询亚马逊FBA库存源数据
|
|
1155
|
+
|
|
1156
|
+
## Docs
|
|
1157
|
+
- 亚马逊源表数据: [查询亚马逊源报表-FBA库存](https://apidoc.lingxing.com/#/docs/SourceData/ManageInventory)
|
|
1158
|
+
- 对应亚马逊 'FBA Manage Inventory' 源报告
|
|
1159
|
+
|
|
1160
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
1161
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1162
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
1163
|
+
:returns `<'FbaInventory'>`: 返回查询到的亚马逊FBA库存结果
|
|
1164
|
+
```python
|
|
1165
|
+
{
|
|
1166
|
+
# 状态码
|
|
1167
|
+
"code": 0,
|
|
1168
|
+
# 提示信息
|
|
1169
|
+
"message": "success",
|
|
1170
|
+
# 错误信息
|
|
1171
|
+
"errors": [],
|
|
1172
|
+
# 请求ID
|
|
1173
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1174
|
+
# 响应时间
|
|
1175
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1176
|
+
# 响应数据量
|
|
1177
|
+
"response_count": 2,
|
|
1178
|
+
# 总数据量
|
|
1179
|
+
"total_count": 2,
|
|
1180
|
+
# 响应数据
|
|
1181
|
+
data: [
|
|
1182
|
+
{
|
|
1183
|
+
# 商品ASIN
|
|
1184
|
+
"asin": "B0D*******",
|
|
1185
|
+
# 亚马逊SKU [原字段 'sku']
|
|
1186
|
+
"msku": "SKU*********",
|
|
1187
|
+
# 亚马逊FNSKU
|
|
1188
|
+
"fnsku": "X00*******",
|
|
1189
|
+
# 商品标题 [原字段 'product_name']
|
|
1190
|
+
"title": "Product Title",
|
|
1191
|
+
# 商品状态
|
|
1192
|
+
"condition": "New",
|
|
1193
|
+
# 商品单位体积 [原字段 'per_unit_volume']
|
|
1194
|
+
"item_volume": 0.02,
|
|
1195
|
+
# 商品单位标准价格 [原字段 'your_price']
|
|
1196
|
+
"standard_price": 39.99,
|
|
1197
|
+
# 商品单位到手价格
|
|
1198
|
+
"landed_price": 39.99,
|
|
1199
|
+
# 商品单位采购成本 [原字段 'cg_price']
|
|
1200
|
+
"cost_of_goods": 0.0,
|
|
1201
|
+
# 是否是FBM配送 (Yes, No) [原字段 'mfn_listing_exists']
|
|
1202
|
+
"is_mfn": "No",
|
|
1203
|
+
# FBM可售库存数量 [原字段 'mfn_fulfillable_quantity']
|
|
1204
|
+
"mfn_fulfillable": 0,
|
|
1205
|
+
# 是否是FBA配送 (Yes, No) [原字段 'afn_listing_exists']
|
|
1206
|
+
"is_afn": "Yes",
|
|
1207
|
+
# FBA总库存数量 [原字段 'afn_total_quantity']
|
|
1208
|
+
# (afn_warehouse + afn_inbound_working & shipped & receiving)
|
|
1209
|
+
"afn_total": 1602,
|
|
1210
|
+
# FBA在库库存数量 [原字段 'afn_warehouse_quantity']
|
|
1211
|
+
# (afn_fulfillable + afn_unsellable + afn_reserved)
|
|
1212
|
+
"afn_warehouse": 1602,
|
|
1213
|
+
# FBA可售库存数量 [原字段 'afn_fulfillable_quantity']
|
|
1214
|
+
"afn_fulfillable": 1598,
|
|
1215
|
+
# FBA不可售库存数量 [原字段 'afn_unsellable_quantity']
|
|
1216
|
+
"afn_unsellable": 0,
|
|
1217
|
+
# FBA预留库存数量 [原字段 'afn_reserved_quantity']
|
|
1218
|
+
"afn_reserved": 2,
|
|
1219
|
+
# FBA 发货计划入库的库存数量 [原字段 'afn_inbound_working_quantity']
|
|
1220
|
+
"afn_inbound_working": 0,
|
|
1221
|
+
# FBA 发货在途的库存数量 [原字段 'afn_inbound_shipped_quantity']
|
|
1222
|
+
"afn_inbound_shipped": 0,
|
|
1223
|
+
# FBA 发货入库接收中的库存数量 [原字段 'afn_inbound_receiving_quantity']
|
|
1224
|
+
"afn_inbound_receiving": 0,
|
|
1225
|
+
# 库存更新时间 (北京时间) [原字段 'gmt_modified']
|
|
1226
|
+
"update_time": "2025-09-03 03:17:48",
|
|
1227
|
+
},
|
|
1228
|
+
...
|
|
1229
|
+
],
|
|
1230
|
+
}
|
|
1231
|
+
```
|
|
1232
|
+
"""
|
|
1233
|
+
url = route.FBA_INVENTORY
|
|
1234
|
+
# 解析并验证参数
|
|
1235
|
+
args = {
|
|
1236
|
+
"sid": sid,
|
|
1237
|
+
"offset": offset,
|
|
1238
|
+
"length": length,
|
|
1239
|
+
}
|
|
1240
|
+
try:
|
|
1241
|
+
p = param.Seller.model_validate(args)
|
|
1242
|
+
except Exception as err:
|
|
1243
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1244
|
+
|
|
1245
|
+
# 发送请求
|
|
1246
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1247
|
+
return schema.FbaInventory.model_validate(data)
|
|
1248
|
+
|
|
1249
|
+
async def FbaReservedInventory(
|
|
1250
|
+
self,
|
|
1251
|
+
sid: int,
|
|
1252
|
+
*,
|
|
1253
|
+
offset: int | None = None,
|
|
1254
|
+
length: int | None = None,
|
|
1255
|
+
) -> schema.FbaReservedInventory:
|
|
1256
|
+
"""查询亚马逊FBA预留库存源数据
|
|
1257
|
+
|
|
1258
|
+
## Docs
|
|
1259
|
+
- 亚马逊源表数据: [查询亚马逊源报表-预留库存](https://apidoc.lingxing.com/#/docs/SourceData/ReservedInventory)
|
|
1260
|
+
- 对应亚马逊 'FBA Reserved Inventory Report' 源报告
|
|
1261
|
+
|
|
1262
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
1263
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1264
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
1265
|
+
:returns `<'FbaReservedInventory'>`: 返回查询到的亚马逊FBA可售库存结果
|
|
1266
|
+
```python
|
|
1267
|
+
{
|
|
1268
|
+
# 状态码
|
|
1269
|
+
"code": 0,
|
|
1270
|
+
# 提示信息
|
|
1271
|
+
"message": "success",
|
|
1272
|
+
# 错误信息
|
|
1273
|
+
"errors": [],
|
|
1274
|
+
# 请求ID
|
|
1275
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1276
|
+
# 响应时间
|
|
1277
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1278
|
+
# 响应数据量
|
|
1279
|
+
"response_count": 2,
|
|
1280
|
+
# 总数据量
|
|
1281
|
+
"total_count": 2,
|
|
1282
|
+
# 响应数据
|
|
1283
|
+
data: [
|
|
1284
|
+
{
|
|
1285
|
+
# 商品ASIN
|
|
1286
|
+
"asin": "B0D*******",
|
|
1287
|
+
# 亚马逊SKU [原字段 'sku']
|
|
1288
|
+
"msku": "SKU*********",
|
|
1289
|
+
# 亚马逊FNSKU
|
|
1290
|
+
"fnsku": "X00*******",
|
|
1291
|
+
# 商品标题 [原字段 'product_name']
|
|
1292
|
+
"title": "Product Title",
|
|
1293
|
+
# FBA 预留库存总数量 [原字段 'reserved_qty']
|
|
1294
|
+
# (afn_reserved_fc_processing & transfer + afn_reserved_customer_order)
|
|
1295
|
+
"afn_reserved_total_qty": 1184,
|
|
1296
|
+
# FBA 在库待调仓的库存数量 [原字段 'reserved_fc_processing']
|
|
1297
|
+
"afn_reserved_fc_processing": 1020,
|
|
1298
|
+
# FBA 在库调仓中的库存数量 [原字段 'reserved_fc_transfers']
|
|
1299
|
+
"afn_reserved_fc_transfers": 37,
|
|
1300
|
+
# FBA 在库待发货的库存数量 [原字段 'reserved_customerorders']
|
|
1301
|
+
"afn_reserved_customer_order": 127,
|
|
1302
|
+
# 库存更新时间 (北京时间) [原字段 'gmt_modified']
|
|
1303
|
+
"update_time": "2025-09-03 06:22:12",
|
|
1304
|
+
},
|
|
1305
|
+
...
|
|
1306
|
+
],
|
|
1307
|
+
}
|
|
1308
|
+
```
|
|
1309
|
+
"""
|
|
1310
|
+
url = route.FBA_RESERVED_INVENTORY
|
|
1311
|
+
# 解析并验证参数
|
|
1312
|
+
args = {
|
|
1313
|
+
"sid": sid,
|
|
1314
|
+
"offset": offset,
|
|
1315
|
+
"length": length,
|
|
1316
|
+
}
|
|
1317
|
+
try:
|
|
1318
|
+
p = param.Seller.model_validate(args)
|
|
1319
|
+
except Exception as err:
|
|
1320
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1321
|
+
|
|
1322
|
+
# 发送请求
|
|
1323
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1324
|
+
return schema.FbaReservedInventory.model_validate(data)
|
|
1325
|
+
|
|
1326
|
+
async def FbaInventoryHealth(
|
|
1327
|
+
self,
|
|
1328
|
+
sid: int,
|
|
1329
|
+
*,
|
|
1330
|
+
offset: int | None = None,
|
|
1331
|
+
length: int | None = None,
|
|
1332
|
+
) -> schema.FbaInventoryHealth:
|
|
1333
|
+
"""查询亚马逊FBA库存健康源数据
|
|
1334
|
+
|
|
1335
|
+
## Docs
|
|
1336
|
+
- 亚马逊源表数据: [查询亚马逊源报表—库龄表](https://apidoc.lingxing.com/#/docs/SourceData/getFbaAgeList)
|
|
1337
|
+
- 对应亚马逊 'Manage Inventory Health' 源报告
|
|
1338
|
+
|
|
1339
|
+
:param sid `<'int'>`: 领星店铺ID
|
|
1340
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1341
|
+
:param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 1000)
|
|
1342
|
+
:returns `<'FbaInventoryHealth'>`: 返回查询到的亚马逊FBA库健康结果
|
|
1343
|
+
```python
|
|
1344
|
+
{
|
|
1345
|
+
# 状态码
|
|
1346
|
+
"code": 0,
|
|
1347
|
+
# 提示信息
|
|
1348
|
+
"message": "success",
|
|
1349
|
+
# 错误信息
|
|
1350
|
+
"errors": [],
|
|
1351
|
+
# 请求ID
|
|
1352
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1353
|
+
# 响应时间
|
|
1354
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1355
|
+
# 响应数据量
|
|
1356
|
+
"response_count": 2,
|
|
1357
|
+
# 总数据量
|
|
1358
|
+
"total_count": 2,
|
|
1359
|
+
# 响应数据
|
|
1360
|
+
data: [
|
|
1361
|
+
{
|
|
1362
|
+
# 领星店铺ID
|
|
1363
|
+
"sid": 1,
|
|
1364
|
+
# 站点国家 [原字段 'marketplace']
|
|
1365
|
+
"country": "US",
|
|
1366
|
+
# 商品ASIN
|
|
1367
|
+
"asin": "B0F*******",
|
|
1368
|
+
# 亚马逊SKU [原字段 'sku']
|
|
1369
|
+
"msku": "SKU*********",
|
|
1370
|
+
# 亚马逊FNSKU
|
|
1371
|
+
"fnsku": "X00*******",
|
|
1372
|
+
# 商品标题 [原字段 'product_name']
|
|
1373
|
+
"title": "Product Title",
|
|
1374
|
+
# 商品状态
|
|
1375
|
+
"condition": "New",
|
|
1376
|
+
# 商品类目 [原字段 'product_group']
|
|
1377
|
+
"category": "gl_office_product",
|
|
1378
|
+
# 商品类目排名 [原字段 'sales_rank']
|
|
1379
|
+
"category_rank": 10659,
|
|
1380
|
+
# 商品仓储类型
|
|
1381
|
+
"storage_type": "Other",
|
|
1382
|
+
# 商品总仓储使用量 (排除待移除商品仓储使用量)
|
|
1383
|
+
"storage_volume": 27.058595,
|
|
1384
|
+
# 商品单位体积
|
|
1385
|
+
"item_volume": 0.026245,
|
|
1386
|
+
# 体积单位 [原字段 'volume_unit_measurement']
|
|
1387
|
+
"volume_unit": "cubic feet",
|
|
1388
|
+
# 可售库存数量 [原字段 'available']
|
|
1389
|
+
"afn_fulfillable": 1031,
|
|
1390
|
+
# 待移除库存数量 [原字段 'pending_removal_quantity']
|
|
1391
|
+
"afn_pending_removal": 0,
|
|
1392
|
+
# FBA 总发货库存数量 [原字段 'inbound_quantity']
|
|
1393
|
+
# (inbound_working + inbound_shipped + inbound_received)
|
|
1394
|
+
"afn_inbound_total": 0,
|
|
1395
|
+
# FBA 发货计划入库的库存数量 [原字段 'inbound_working']
|
|
1396
|
+
"afn_inbound_working": 0,
|
|
1397
|
+
# FBA 发货在途的库存数量 [原字段 'inbound_shipped']
|
|
1398
|
+
"afn_inbound_shipped": 0,
|
|
1399
|
+
# FBA 发货入库接收中的库存数量 [原字段 'inbound_received']
|
|
1400
|
+
"afn_inbound_receiving": 0,
|
|
1401
|
+
# 库龄0-30天的库存数量 [原字段 'inv_age_0_to_30_days']
|
|
1402
|
+
"age_0_to_30_days": 0,
|
|
1403
|
+
# 库龄31-60天的库存数量 [原字段 'inv_age_31_to_60_days']
|
|
1404
|
+
"age_31_to_60_days": 2,
|
|
1405
|
+
# 库龄61-90天的库存数量 [原字段 'inv_age_61_to_90_days']
|
|
1406
|
+
"age_61_to_90_days": 1,
|
|
1407
|
+
# 库龄0-90天的库存数量 [原字段 'inv_age_0_to_90_days']
|
|
1408
|
+
"age_0_to_90_days": 3,
|
|
1409
|
+
# 库龄91-180天的库存数量 [原字段 'inv_age_91_to_180_days']
|
|
1410
|
+
"age_91_to_180_days": 1109,
|
|
1411
|
+
# 库龄181-270天的库存数量 [原字段 'inv_age_181_to_270_days']
|
|
1412
|
+
"age_181_to_270_days": 0,
|
|
1413
|
+
# 库龄181-330天的库存数量 [原字段 'inv_age_181_to_330_days']
|
|
1414
|
+
"age_181_to_330_days": 0,
|
|
1415
|
+
# 库龄271-330天的库存数量 [原字段 'inv_age_271_to_330_days_quantity']
|
|
1416
|
+
"age_271_to_330_days": 0,
|
|
1417
|
+
# 库龄271-365天的库存数量 [原字段 'inv_age_271_to_365_days']
|
|
1418
|
+
"age_271_to_365_days": 0,
|
|
1419
|
+
# 库龄331-365天的库存数量 [原字段 'inv_age_331_to_365_days']
|
|
1420
|
+
"age_331_to_365_days": 0,
|
|
1421
|
+
# 库龄365天以上的库存数量 [原字段 'inv_age_365_plus_days']
|
|
1422
|
+
"age_365_plus_days": 0,
|
|
1423
|
+
# 是否免除长期仓储费 (Yes, No) [原字段 'exempted_from_low_inventory_level_fee']
|
|
1424
|
+
"is_ltsf_exempted": "Yes",
|
|
1425
|
+
# 当前周是否收取低库存水平费 (Yes, No) [原字段 'low_Inventory_Level_fee_applied_in_current_week']
|
|
1426
|
+
"is_weekly_ltsf_applied": "No",
|
|
1427
|
+
# 库龄180天以上收取长期仓储费的库存数量 [原字段 'qty_to_be_charged_ltsf_6_mo']
|
|
1428
|
+
"ltsf_180_plus_days": 0,
|
|
1429
|
+
# 库龄180天以上预估收取长期仓储费的金额 [原字段 'projected_ltsf_6_mo']
|
|
1430
|
+
"estimated_ltsf_180_plus_fee": 0.0,
|
|
1431
|
+
# 库龄365天以上收取长期仓储费的库存数量 [原字段 'qty_to_be_charged_ltsf_12_mo']
|
|
1432
|
+
"ltsf_365_plus_days": 0,
|
|
1433
|
+
# 库龄365天以上预估收取长期仓储费的金额 [原字段 'projected_ltsf_12_mo']
|
|
1434
|
+
"estimated_ltsf_365_plus_fee": 0.0,
|
|
1435
|
+
# 预估截至下一收费日期 (每月15日) 长期仓储费金额 [原字段 'estimated_ltsf_next_charge']
|
|
1436
|
+
"estimated_ltsf_next_charge_fee": 0.0,
|
|
1437
|
+
# 是否免除低库存成本覆盖费 (Yes, No) [原字段 'exempted_from_low_inventory_cost_coverage_fee']
|
|
1438
|
+
"is_licc_exempted": "",
|
|
1439
|
+
# 当前周是否收取低库存成本覆盖费 (Yes, No) [原字段 'low_inventory_cost_coverage_fee_applied_in_current_week']
|
|
1440
|
+
"is_weekly_licc_applied": "",
|
|
1441
|
+
# 预估往后30天内的仓储费金额 (月度仓储 + 长期仓储) [原字段 'estimated_storage_cost_next_month']
|
|
1442
|
+
"estimated_30_days_storage_fee": 20.4,
|
|
1443
|
+
# 货币代码 [原字段 'currency']
|
|
1444
|
+
"currency_code": "USD",
|
|
1445
|
+
# 商品标准价 (不包含促销, 运费, 积分) [原字段 'your_price']
|
|
1446
|
+
"standard_price": 39.89,
|
|
1447
|
+
# 商品优惠价 [原字段 'sales_price']
|
|
1448
|
+
"sale_price": 0.0,
|
|
1449
|
+
# 商品促销价 [原字段 'featuredoffer_price']
|
|
1450
|
+
"offer_price": 39.89,
|
|
1451
|
+
# 商品最低价 (含运费) [原字段 'lowest_price_new_plus_shipping']
|
|
1452
|
+
"lowest_price": 35.9,
|
|
1453
|
+
# 商品最低二手价 (含运费) [原字段 'lowest_price_used']
|
|
1454
|
+
"lowest_used_price": 0.0,
|
|
1455
|
+
# 最近7天发货销售额 [原字段 'sales_shipped_last_7_days']
|
|
1456
|
+
"shipped_amt_7d": 9796.72,
|
|
1457
|
+
# 最近30天发货销售额 [原字段 'sales_shipped_last_30_days']
|
|
1458
|
+
"shipped_amt_30d": 16675.3,
|
|
1459
|
+
# 最近60天发货销售额 [原字段 'sales_shipped_last_60_days']
|
|
1460
|
+
"shipped_amt_60d": 25892.12,
|
|
1461
|
+
# 最近90天发货销售额 [原字段 'sales_shipped_last_90_days']
|
|
1462
|
+
"shipped_amt_90d": 30838.75,
|
|
1463
|
+
# 最近7天发货数量 [原字段 'units_shipped_t7']
|
|
1464
|
+
"shipped_qty_7d": 272,
|
|
1465
|
+
# 最近30天发货数量 [原字段 'units_shipped_t30']
|
|
1466
|
+
"shipped_qty_30d": 454,
|
|
1467
|
+
# 最近60天发货数量 [原字段 'units_shipped_t60']
|
|
1468
|
+
"shipped_qty_60d": 690,
|
|
1469
|
+
# 最近90天发货数量 [原字段 'units_shipped_t90']
|
|
1470
|
+
"shipped_qty_90d": 816,
|
|
1471
|
+
# 库存售出率 (过去 90 天销量除以平均可售库存) [原字段 'sell_through']
|
|
1472
|
+
"sell_through_rate": 0.49,
|
|
1473
|
+
# 历史连续至少6个月无销售库存 [原字段 'no_sale_last_6_months']
|
|
1474
|
+
"historical_no_sale_6m": 0,
|
|
1475
|
+
# 历史供货天数 (取短期&长期更大值)
|
|
1476
|
+
"historical_days_of_supply": 195.7,
|
|
1477
|
+
# 历史短期供货天数 [原字段 'short_term_historical_days_of_supply']
|
|
1478
|
+
"historical_st_days_of_supply": 108.0,
|
|
1479
|
+
# 历史长期供货天数 [原字段 'long_term_historical_days_of_supply']
|
|
1480
|
+
"historical_lt_days_of_supply": 195.7,
|
|
1481
|
+
# 预估可供货天数 [原字段 'days_of_supply']
|
|
1482
|
+
"estimated_days_of_supply": 175,
|
|
1483
|
+
# 基于过去30天数据预估可供货周数 [原字段 'weeks_of_cover_t30']
|
|
1484
|
+
"estimated_weeks_of_cover_30d": 9,
|
|
1485
|
+
# 基于过去90天数据预估可供货周数 [原字段 'weeks_of_cover_t90']
|
|
1486
|
+
"estimated_weeks_of_cover_90d": 16,
|
|
1487
|
+
# 预估冗余库存数量 [原字段 'estimated_excess_quantity']
|
|
1488
|
+
"estimated_excess": 0,
|
|
1489
|
+
# 库存健康状态 [原字段 'fba_inventory_level_health_status']
|
|
1490
|
+
"inventory_health_status": "Healthy",
|
|
1491
|
+
# 库存预警信息 [原字段 'alert']
|
|
1492
|
+
"inventory_alert": "Low traffic",
|
|
1493
|
+
# 推荐安全库存水平 [原字段 'healthy_inventory_level']
|
|
1494
|
+
"recommended_healthy_qty": 0,
|
|
1495
|
+
# 推荐最低库存水平 [原字段 'fba_minimum_inventory_level']
|
|
1496
|
+
"recommended_minimum_qty": 372,
|
|
1497
|
+
# 推荐移除库存数量 [原字段 'recommended_removal_quantity']
|
|
1498
|
+
"recommended_removal_qty": 0,
|
|
1499
|
+
# 推荐促销价格
|
|
1500
|
+
"recommended_sales_price": 0.0,
|
|
1501
|
+
# 推荐促销天数 [原字段 'recommended_sale_duration_days']
|
|
1502
|
+
"recommended_sales_days": 0,
|
|
1503
|
+
# 推荐操作
|
|
1504
|
+
"recommended_action": "NoRestockExcessActionRequired",
|
|
1505
|
+
# 预计推荐操作节省仓储费用 [原字段 'estimated_cost_savings_of_recommended_actions']
|
|
1506
|
+
"estimated_savings_of_recommended_actions": 0.0,
|
|
1507
|
+
# 数据日期 [原字段 'snapshot_date']
|
|
1508
|
+
"report_date": "2025-09-02",
|
|
1509
|
+
},
|
|
1510
|
+
...
|
|
1511
|
+
],
|
|
1512
|
+
}
|
|
1513
|
+
```
|
|
1514
|
+
"""
|
|
1515
|
+
url = route.FBA_INVENTORY_HEALTH
|
|
1516
|
+
# 解析并验证参数
|
|
1517
|
+
args = {
|
|
1518
|
+
"sid": sid,
|
|
1519
|
+
"offset": offset,
|
|
1520
|
+
"length": length,
|
|
1521
|
+
}
|
|
1522
|
+
try:
|
|
1523
|
+
p = param.Seller.model_validate(args)
|
|
1524
|
+
except Exception as err:
|
|
1525
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1526
|
+
|
|
1527
|
+
# 发送请求
|
|
1528
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1529
|
+
return schema.FbaInventoryHealth.model_validate(data)
|
|
1530
|
+
|
|
1531
|
+
async def FbaInventoryAdjustments(
|
|
1532
|
+
self,
|
|
1533
|
+
start_date: str | datetime.date | datetime.datetime,
|
|
1534
|
+
end_date: str | datetime.date | datetime.datetime,
|
|
1535
|
+
*,
|
|
1536
|
+
sids: int | list[int] | None = None,
|
|
1537
|
+
search_field: SEARCH_FIELD | None = None,
|
|
1538
|
+
search_value: str | None = None,
|
|
1539
|
+
offset: int | None = None,
|
|
1540
|
+
length: int | None = None,
|
|
1541
|
+
) -> schema.FbaInventoryAdjustments:
|
|
1542
|
+
"""查询亚马逊FBA库存调整源数据
|
|
1543
|
+
|
|
1544
|
+
## Docs
|
|
1545
|
+
- 亚马逊源表数据: [查询亚马逊源报表-盘存记录](https://apidoc.lingxing.com/#/docs/SourceData/AdjustmentList)
|
|
1546
|
+
|
|
1547
|
+
:param start_date `<'str/date/datetime'>`: 查询开始日期
|
|
1548
|
+
:param end_date `<'str/date/datetime'>`: 查询结束日期
|
|
1549
|
+
:param sids `<'int/list[int]/None'>`: 领星店铺ID或ID列表, 默认 `None` (所有店铺)
|
|
1550
|
+
:param search_field `<'str/None'>`: 搜索字段, 默认 `None` (不搜索), 可选值:
|
|
1551
|
+
|
|
1552
|
+
- `'asin'`: 按 ASIN 搜索
|
|
1553
|
+
- `'msku'`: 按亚马逊 SKU 搜索
|
|
1554
|
+
- `'fnsku'`: 按亚马逊 FNSKU 搜索
|
|
1555
|
+
- `'title'`: 按商品标题搜索
|
|
1556
|
+
- `'transaction_item_id'`: 按调整交易ID搜索
|
|
1557
|
+
|
|
1558
|
+
:param search_value `<'str/None'>`: 搜索值, 默认 `None` (search_field 有值时必填)
|
|
1559
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1560
|
+
:param length `<'int/None'>`: 分页长度, 最大值 10000, 默认 `None` (使用: 20)
|
|
1561
|
+
:returns `<'FbaInventoryAdjustments'>`: 返回查询到的亚马逊FBA库存调整结果
|
|
1562
|
+
```python
|
|
1563
|
+
{
|
|
1564
|
+
# 状态码
|
|
1565
|
+
"code": 0,
|
|
1566
|
+
# 提示信息
|
|
1567
|
+
"message": "success",
|
|
1568
|
+
# 错误信息
|
|
1569
|
+
"errors": [],
|
|
1570
|
+
# 请求ID
|
|
1571
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1572
|
+
# 响应时间
|
|
1573
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1574
|
+
# 响应数据量
|
|
1575
|
+
"response_count": 2,
|
|
1576
|
+
# 总数据量
|
|
1577
|
+
"total_count": 2,
|
|
1578
|
+
# 响应数据
|
|
1579
|
+
data: []
|
|
1580
|
+
}
|
|
1581
|
+
```
|
|
1582
|
+
"""
|
|
1583
|
+
url = route.FBA_INVENTORY_ADJUSTMENTS
|
|
1584
|
+
# 解析并验证参数
|
|
1585
|
+
args = {
|
|
1586
|
+
"start_date": start_date,
|
|
1587
|
+
"end_date": end_date,
|
|
1588
|
+
"sids": sids,
|
|
1589
|
+
"search_field": search_field,
|
|
1590
|
+
"search_value": search_value,
|
|
1591
|
+
"offset": offset,
|
|
1592
|
+
"length": length,
|
|
1593
|
+
}
|
|
1594
|
+
try:
|
|
1595
|
+
p = param.FbaInventoryAdjustments.model_validate(args)
|
|
1596
|
+
except Exception as err:
|
|
1597
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1598
|
+
|
|
1599
|
+
# 发送请求
|
|
1600
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1601
|
+
return schema.FbaInventoryAdjustments.model_validate(data)
|
|
1602
|
+
|
|
1603
|
+
# 报告导出 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
1604
|
+
async def ExportReportTask(
|
|
1605
|
+
self,
|
|
1606
|
+
seller_id: str,
|
|
1607
|
+
marketplace_ids: str | list[str],
|
|
1608
|
+
region: REPORT_REGION,
|
|
1609
|
+
report_type: str,
|
|
1610
|
+
start_time: str | datetime.date | datetime.datetime | None = None,
|
|
1611
|
+
end_time: str | datetime.date | datetime.datetime | None = None,
|
|
1612
|
+
) -> schema.ExportReportTask:
|
|
1613
|
+
"""创建报告导出任务
|
|
1614
|
+
|
|
1615
|
+
## Docs
|
|
1616
|
+
- 亚马逊源表数据: [报告导出 - 创建导出任务](https://apidoc.lingxing.com/#/docs/Statistics/reportCreateReportExportTask)
|
|
1617
|
+
|
|
1618
|
+
:param seller_id `<'str'>`: 亚马逊卖家ID, 参数来源: `Seller.seller_id`
|
|
1619
|
+
:param marketplace_ids `<'str/list[str]'>`: 亚马逊站点ID或ID列表, 参数来源: `Seller.marketplace_id`
|
|
1620
|
+
:param region `<'str'>`: 亚马逊站点区域, 参数来源: `Seller.region`, 可选值:
|
|
1621
|
+
|
|
1622
|
+
- `'NA'`: 北美站点
|
|
1623
|
+
- `'EU'`: 欧洲站点
|
|
1624
|
+
- `'FE'`: 远东站点
|
|
1625
|
+
|
|
1626
|
+
:param report_type `<'str'>`: 报告类型, 可选值请参考亚马逊官方: [Report Type Values](https://apidoc.lingxing.com/#/docs/Statistics/reportTypeList)
|
|
1627
|
+
:param start_time `<'str/date/datetime/None'>`: 报告数据开始时间, 默认 `None`
|
|
1628
|
+
:param end_time `<'str/date/datetime/None'>`: 报告数据结束时间, 默认 `None`
|
|
1629
|
+
:returns `<'ExportReportTask'>`: 返回创建的报告导出任务结果
|
|
1630
|
+
```python
|
|
1631
|
+
{
|
|
1632
|
+
# 状态码
|
|
1633
|
+
"code": 0,
|
|
1634
|
+
# 提示信息
|
|
1635
|
+
"message": "success",
|
|
1636
|
+
# 错误信息
|
|
1637
|
+
"errors": [],
|
|
1638
|
+
# 请求ID
|
|
1639
|
+
"request_id": "2273ee319fe84b539b6269bb664c22fb.208.17569687977541427",
|
|
1640
|
+
# 响应时间
|
|
1641
|
+
"response_time": "2025-09-04 14:53:17",
|
|
1642
|
+
# 响应数据量
|
|
1643
|
+
"response_count": 1,
|
|
1644
|
+
# 总数据量
|
|
1645
|
+
"total_count": 1,
|
|
1646
|
+
# 响应数据
|
|
1647
|
+
"data": {
|
|
1648
|
+
# 报告导出任务ID
|
|
1649
|
+
"task_id": "620358fe-ca1e-4241-b2ef-c3f1e3aae5e6"
|
|
1650
|
+
},
|
|
1651
|
+
}
|
|
1652
|
+
```
|
|
1653
|
+
"""
|
|
1654
|
+
url = route.EXPORT_REPORT_TASK
|
|
1655
|
+
# 解析并验证参数
|
|
1656
|
+
args = {
|
|
1657
|
+
"seller_id": seller_id,
|
|
1658
|
+
"marketplace_ids": marketplace_ids,
|
|
1659
|
+
"region": region,
|
|
1660
|
+
"report_type": report_type,
|
|
1661
|
+
"start_time": start_time,
|
|
1662
|
+
"end_time": end_time,
|
|
1663
|
+
}
|
|
1664
|
+
try:
|
|
1665
|
+
p = param.ExportReportTask.model_validate(args)
|
|
1666
|
+
except Exception as err:
|
|
1667
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1668
|
+
|
|
1669
|
+
# 发送请求
|
|
1670
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1671
|
+
return schema.ExportReportTask.model_validate(data)
|
|
1672
|
+
|
|
1673
|
+
async def ExportReportResult(
|
|
1674
|
+
self,
|
|
1675
|
+
seller_id: str,
|
|
1676
|
+
task_id: str,
|
|
1677
|
+
region: REPORT_REGION,
|
|
1678
|
+
) -> schema.ExportReportResult:
|
|
1679
|
+
"""查询报告导出结果
|
|
1680
|
+
|
|
1681
|
+
## Docs
|
|
1682
|
+
- 亚马逊源表数据: [报告导出-查询导出任务结果](https://apidoc.lingxing.com/#/docs/Statistics/reportQueryReportExportTask)
|
|
1683
|
+
|
|
1684
|
+
:param seller_id `<'str'>`: 亚马逊卖家ID, 参数来源: `Seller.seller_id`
|
|
1685
|
+
:param task_id `<'str'>`: 报告导出任务ID, 参数来源: `ExportReportTask.task_id`
|
|
1686
|
+
:param region `<'str'>`: 亚马逊站点区域, 参数来源: `Seller.region`, 可选值:
|
|
1687
|
+
|
|
1688
|
+
- `'NA'`: 北美站点
|
|
1689
|
+
- `'EU'`: 欧洲站点
|
|
1690
|
+
- `'FE'`: 远东站点
|
|
1691
|
+
|
|
1692
|
+
:returns `<'ExportReportResult'>`: 返回查询的报告导出结果
|
|
1693
|
+
```python
|
|
1694
|
+
{
|
|
1695
|
+
# 状态码
|
|
1696
|
+
"code": 0,
|
|
1697
|
+
# 提示信息
|
|
1698
|
+
"message": "success",
|
|
1699
|
+
# 错误信息
|
|
1700
|
+
"errors": [],
|
|
1701
|
+
# 请求ID
|
|
1702
|
+
"request_id": "2273ee319fe84b539b6269bb664c22fb.208.17569687977541427",
|
|
1703
|
+
# 响应时间
|
|
1704
|
+
"response_time": "2025-09-04 14:53:17",
|
|
1705
|
+
# 响应数据量
|
|
1706
|
+
"response_count": 1,
|
|
1707
|
+
# 总数据量
|
|
1708
|
+
"total_count": 1,
|
|
1709
|
+
# 响应数据
|
|
1710
|
+
"data": {
|
|
1711
|
+
# 报告文件ID
|
|
1712
|
+
"report_document_id": "",
|
|
1713
|
+
# 报告生成进度状态
|
|
1714
|
+
"progress_status": "",
|
|
1715
|
+
# 报告压缩算法
|
|
1716
|
+
"compression_algorithm": "",
|
|
1717
|
+
# 报告下载链接
|
|
1718
|
+
"url": "",
|
|
1719
|
+
},
|
|
1720
|
+
}
|
|
1721
|
+
```
|
|
1722
|
+
"""
|
|
1723
|
+
url = route.EXPORT_REPORT_RESULT
|
|
1724
|
+
# 解析并验证参数
|
|
1725
|
+
args = {
|
|
1726
|
+
"seller_id": seller_id,
|
|
1727
|
+
"task_id": task_id,
|
|
1728
|
+
"region": region,
|
|
1729
|
+
}
|
|
1730
|
+
try:
|
|
1731
|
+
p = param.ExportReportResult.model_validate(args)
|
|
1732
|
+
except Exception as err:
|
|
1733
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1734
|
+
|
|
1735
|
+
# 发送请求
|
|
1736
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1737
|
+
return schema.ExportReportResult.model_validate(data)
|
|
1738
|
+
|
|
1739
|
+
async def ExportReportRefresh(
|
|
1740
|
+
self,
|
|
1741
|
+
seller_id: str,
|
|
1742
|
+
report_document_id: str,
|
|
1743
|
+
region: REPORT_REGION,
|
|
1744
|
+
) -> schema.ExportReportRefresh:
|
|
1745
|
+
"""报告导出结果续期
|
|
1746
|
+
|
|
1747
|
+
## Docs
|
|
1748
|
+
- 亚马逊源表数据: [报告导出 - 报告下载链接续期](https://apidoc.lingxing.com/#/docs/Statistics/AmazonReportExportTask)
|
|
1749
|
+
|
|
1750
|
+
:param seller_id `<'str'>`: 亚马逊卖家ID, 参数来源: `Seller.seller_id`
|
|
1751
|
+
:param report_document_id `<'str'>`: 报告文件ID, 参数来源: `ExportReportResult.report_document_id`
|
|
1752
|
+
:param region `<'str'>`: 亚马逊站点区域, 参数来源: `Seller.region`, 可选值:
|
|
1753
|
+
|
|
1754
|
+
- `'NA'`: 北美站点
|
|
1755
|
+
- `'EU'`: 欧洲站点
|
|
1756
|
+
- `'FE'`: 远东站点
|
|
1757
|
+
|
|
1758
|
+
:returns `<'ExportReportRefresh'>`: 返回报告下载链接续期结果
|
|
1759
|
+
```python
|
|
1760
|
+
{
|
|
1761
|
+
# 状态码
|
|
1762
|
+
"code": 0,
|
|
1763
|
+
# 提示信息
|
|
1764
|
+
"message": "success",
|
|
1765
|
+
# 错误信息
|
|
1766
|
+
"errors": [],
|
|
1767
|
+
# 请求ID
|
|
1768
|
+
"request_id": "2273ee319fe84b539b6269bb664c22fb.208.17569687977541427",
|
|
1769
|
+
# 响应时间
|
|
1770
|
+
"response_time": "2025-09-04 14:53:17",
|
|
1771
|
+
# 响应数据量
|
|
1772
|
+
"response_count": 1,
|
|
1773
|
+
# 总数据量
|
|
1774
|
+
"total_count": 1,
|
|
1775
|
+
# 响应数据
|
|
1776
|
+
"data": {
|
|
1777
|
+
# 报告文件ID
|
|
1778
|
+
"report_document_id": ""
|
|
1779
|
+
# 报告下载链接
|
|
1780
|
+
"url": "",
|
|
1781
|
+
},
|
|
1782
|
+
}
|
|
1783
|
+
```
|
|
1784
|
+
"""
|
|
1785
|
+
url = route.EXPORT_REPORT_REFRESH
|
|
1786
|
+
# 解析并验证参数
|
|
1787
|
+
args = {
|
|
1788
|
+
"seller_id": seller_id,
|
|
1789
|
+
"report_document_id": report_document_id,
|
|
1790
|
+
"region": region,
|
|
1791
|
+
}
|
|
1792
|
+
try:
|
|
1793
|
+
p = param.ExportReportRefresh.model_validate(args)
|
|
1794
|
+
except Exception as err:
|
|
1795
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1796
|
+
|
|
1797
|
+
# 发送请求
|
|
1798
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1799
|
+
return schema.ExportReportRefresh.model_validate(data)
|