-
Notifications
You must be signed in to change notification settings - Fork 0
/
api0816
396 lines (347 loc) · 11.4 KB
/
api0816
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
对接流程描述
1. 签约完成后,由客服提供账号和token.
2. 使用:HTTP协议,JSON数据格式。http请求头(header)设置:Content-Type: application/json
3. 统一默认请求方法:POST
4. 为了更快的完成对接,请使用下文提供的【账号,密码,token,仓库代码,产品编码:P2019080100000004】正式上线后,只需要更换不同的产品编码即可
生成签名
1. 拼接签名串
按字段名的字母顺序拼接(包括data中的json字符串也按此规则),将token放在字符串的两端,如下所示:
签名串 = token + action + actionValue + appKey + appKeyValue + data + dataValue + format + formatValue + platform + platformValue + signMethod + signMethodValue + timestamp + timestampValue + version + versionValue + token
*特别说明*:生成签名时需要注意一下几点:
签名时参数必须按字母顺序从小到大排序(字典序);
* 如果参数的值为空不参与签名,如JAVA中参数值为null的,不会参与签名("" 与 '' 认 为非空,需要参与签名);
* 参数名区分大小写;
* 在向系统发送HTTP请求时必须使用正确的编码格式(默认UTF-8)
示例
签名串 = `87ae42f6b7e049baa70c8129b541d389actionapi.postorder.createappKeywinitdata{"buyerAddress1":"add1","buyerAddress2":"add2","buyerCity":"City of industry","buyerCountry":"US","buyerEmail":"test@test.com","buyerHouseNo":"","buyerName":"test","buyerPhone":"0231234111","buyerPostcode":"91748","buyerState":"CA","customerOrderNo":"Test0000013","parcels":[{"height":2,"length":10,"parcelDesc":"pacel 004","parcelItems":[{"declaredCurrency":"USD","declaredNameCn":"sfefe","declaredNameEn":"test item","declaredValue":10,"height":10,"itemCode":"TT0001","itemName":"test item 0001","length":10,"qty":1,"saleCurrency":"USD","salePrice":12,"volume":0.0001,"weight":0.004,"width":8}],"parcelNo":"010","volume":0.0001,"weight":114,"width":8}],"productCode":"P2019052600000001","warehouseCode":"USKY3"}formatjsonplatformOnline SellersignMethodmd5timestampThu Aug 01 18:55:46 CST 2019version1.0 87ae42f6b7e049baa70c8129b541d389 `
2. 生成签名
对以上拼接后的签名串进行MD5运算,并转换成大写的32位签名。
签名 = toUpperCase(MD5(签名串))
上述示例生成的签名为:3E3D21E8BB9D39BF84B159B88D3BB11F
备注:以下所有接口中的sign字段按照此方法生成。
*请求说明*
<br>测试环境URL http://sandbox.postkeeper.zhengfx.com/postkeeper/api/service
<br>正式环境URL http://postkeeper.zhengfx.com/postkeeper/api/service
测试用户名:test
<br>测试密码:test2019
<br>测试token: 87ae42f6b7e049baa70c8129b541d389
<br>测试仓库:ZFX_US_KY
验证方式 Token,md5
<br>格式 json
<br>字符编码 UTF-8
<br>请求方式 http
一、创建订单接口(api.postorder.create)
接口说明
通过本接口,用户可以创建订单
请求参数:
参数|类型|是否必填|说明|举例
----|----|----|----|----
action|string|是|接口动作|默认为:api.postorder.create
appKey|string|是|用户名|
format|string|是|格式|默认为:json
language|string|是|语言|默认zh_CN
platform|string|是|平台
signMethod|string|是|加密方式|默认为:md5
sign|string|是|签名|
timestamp|string|是|时间戳|默认为当前时间;格式:年-月-日 时:分:秒
version|string|是|版本号|默认为:1.0
customerOrderNo|string|是|客户订单号|
productCode|string|是|产品编码|
warehouseCode|string|是|仓库编码|
buyerName|string|是|买方姓名|
buyerPhone|string|是|买方手机号码|
buyerEmail|string|是|买方邮箱|
buyerCountry|string|是|买方国家|
buyerState|string|是|买方所在州|
buyerCity|string|是|买方所在城市|
buyerHouseNo|string|否|买方房屋编号|
buyerPostcode|string|是|买方邮政编码|
buyerAddress1|string|是|买方地址1|
buyerAddress2|string|是|买方地址2|
parcelNo|string|是|包裹编号|
parcelDesc|string|是|包裹描述|
length|double|是|包裹长度|单位cm
width|double|是|包裹宽度|单位cm
height|double|是|包裹高度|单位cm
weight|double|是|包裹重量|单位kg
volume|double|是|包裹体积|单位CBM
itemCode|string|是|商品编码|
itemName|string|是|商品名称|
saleCurrency|string|是|销售币种|
salePrice|double|是|销售单价|
declaredCurrency|string|是|报关币种|
declaredNameCn|string|是|报关中文名称|
declaredNameEn|string|是|报关英文名称|
declaredValue|double|是|申报价值|
length|double|是|商品长度|单位cm
width|double|是|商品宽度|单位cm
height|double|是|商品高度|单位cm
volume|double|是|商品体积|单位cbm
weight|double|是|商品重量|单位kg
qty|double|是|商品数量|
参数示列:
```
{
"action": "api.postorder.create",
"appKey": "test",
"format": "json",
"language": "zh_CN",
"platform": "FS",
"signMethod": "md5",
"sign": "CD90A7E7959869217DF4F04BF26962C1",
"timestamp": "2019-08-14 23:07:46",
"version": "1.0",
"data": {
"customerOrderNo": "Test0000013",
"productCode": "P2019080100000004",
"warehouseCode": "ZFX_US_KY",
"buyerName": "test",
"buyerPhone": "0231234111",
"buyerEmail": "test@test.com",
"buyerCountry": "US",
"buyerState": "TX",
"buyerCity": "Humble",
"buyerHouseNo": "",
"buyerPostcode": "77346",
"buyerAddress1": "add1",
"buyerAddress2": "add2",
"parcels": [
{
"parcelNo": "010",
"parcelDesc": "pacel 004",
"length": 10,
"width": 8,
"height": 2,
"weight": 0.114,
"volume": 0.0001,
"parcelItems": [
{
"itemCode": "TT0001",
"itemName": "test item 0001",
"saleCurrency": "USD",
"salePrice": 12,
"declaredCurrency": "USD",
"declaredNameCn": "测试商品",
"declaredNameEn": "test item",
"declaredValue": 10,
"length": 10,
"width": 10,
"height": 10,
"volume": 0.0001,
"weight": 400,
"qty": 1
}
]
}
]
}
}
```
响应参数:
参数|类型|是否必填|说明|举例
---|---|-------|----|----
code|string|是|返回码|0:代码成功
msg|string|是|返回消息
orderNo|string|是|生成订单号
参数示列:
```
{
"code": "0",
"msg": "操作成功",
"data": {
"orderNo": "PO2019062400000026"
}
}
```
二、获取面单接口(api.postorder.getLabel)
接口说明
通过本接口,用户可以打印面单
请求参数:
参数|类型|是否必填|说明|举例
---|----|------|---|---
action|string|是|接口动作|默认为:api.postorder.getLabel
appKey|string|是|用户名|
format|string|是|格式|默认为:json
language|string|是|语言|默认zh_CN
platform|string|是|平台|默认为:
signMethod|string|是|加密方式|默认为:md5
sign|string|是|签名|
timestamp|string|是|时间戳|默认为当前时间;格式:年-月-日 时:分:秒
version|string|是|版本号|默认为:1.0
orderNo|string|是|订单号|
参数示列:
```
{
"action": "api.postorder.getLabel",
"appKey": "test",
"format": "json",
"language": "zh_CN",
"platform": "FS",
"signMethod": "md5",
"sign": "0EC193440CE649DE09EF32E7AC01CB34",
"timestamp": "2019-08-14 22:59:46",
"version": "1.0",
"data": {
"orderNo": "PO19081400000715"
}
}
```
响应参数:
参数|类型|是否必填|说明|举例
---|----|------|---|----
code|string|是|返回码|0:代码成功
msg|string|是|返回消息|
trackingNo|string|是|运单轨迹|
label|string|是|标签|
参数示列:
```
{
"code": "0",
"msg": "",
"data": {
"labelList": [
{
"trackingNo": "9400110200882066932722",
"label": "iVBORw0KGgoAAAANSUh........
}
]
}
}
```
三、确认发货接口(api.postorder.confirm)
接口说明
通过本接口,用户可以打印面单
请求参数:
参数|类型|是否必填|说明|举例
---|----|------|----|----
action|string|是|接口动作|默认为:api.postorder. confirm
appKey|string|是|用户名|
format|string|是|格式|默认为:json
language|string|是|语言|默认zh_CN
platform|string|是|平台|默认为:
signMethod|string|是|加密方式|默认为:md5
sign|string|是|签名|
timestamp|string|是|时间戳|默认为当前时间;格式:年-月-日 时:分:秒
version|string|是|版本号|默认为:1.0
orderNos|string|是|订单号|确认发货的订单号
参数示列:
```
{
"action": "api.postorder.confirm",
"appKey": "XXX",
"format": "json",
"language": "zh_CN",
"platform": "FS",
"signMethod": "md5",
"sign": "string",
"timestamp": "2019-05-16 13:07:46",
"version": "1.0",
"data": {
"customerDeliveryNo": "12341",
"deliveryTime": "2019-07-16 13:07:46",
"orderNos":["PO2019062100000019","PO2019062100000020"]
}
}
```
响应参数:
参数|类型|是否必填|说明|举例
code|string|是|返回码|0:代码成功
msg|string|是|返回消息|
trackingNo|string|是|运单轨迹|
label|string|是|标签|
参数示列:
```
{
}
```
四、获取发货单接口(api.postorder.getManifest)
接口说明
通过本接口,用户可以打印面单
请求参数:
参数|类型|是否必填|说明|举例
action|string|是|接口动作|默认为:api.postorder. getManifest
appKey|string|是|用户名|
format|string|是|格式|默认为:json
language|string|是|语言|默认zh_CN
platform|string|是|平台|默认为:
signMethod|string|是|加密方式|默认为:md5
sign|string|是|签名|
timestamp|string|是|时间戳|默认为当前时间;格式:年-月-日 时:分:秒
version|string|是|版本号|默认为:1.0
orderNos|string|是|订单号|确认发货的订单号
参数示列:
```
{
"action": "api.postorder.confirm",
"appKey": "XXX",
"format": "json",
"language": "zh_CN",
"platform": "FS",
"signMethod": "md5",
"sign": "string",
"timestamp": "2019-05-16 13:07:46",
"version": "1.0",
"data": {
"manifestNo": "MF2019070700000002"
}
}
```
响应参数:
参数|类型|是否必填|说明|举例
--|-----|------|---|----
code| string|是|返回码|0:代码成功
msg|string|是|返回消息|
trackingNo|string|是|运单轨迹|
label|string|是|标签
参数示列:
```
{
}
```
五、取消订单接口(api.postorder.cancel)
接口说明
通过本接口,用户可以取消订单
请求参数:
参数|类型|是否必填|说明|举例
---|---|-------|---|----
action|string|是|接口动作|默认为:api.postorder. cancel
appKey|string|是|用户名|
format|string|是|格式|默认为:json
language|string|是|语言|默认zh_CN
platform|string|是|平台|
signMethod|string|是|加密方式|默认为:md5
sign|string|是|签名|
timestamp|string|是|时间戳|默认为当前时间;格式:年-月-日 时:分:秒
version|string|是|版本号|默认为:1.0
orderNo|string|是|订单号|
参数示列:
```
{
"action": "api.postorder.cancel",
"appKey": "test",
"format": "json",
"language": "zh_CN",
"platform": "FS",
"signMethod": "md5",
"sign": "85E23DA6A0A7B8D97B969F0CDD499F45",
"timestamp": "2019-08-14 23:07:46",
"version": "1.0",
"data": {
"orderNo":"PO19081400000716"
}
}
```
响应参数:
参数|类型|是否必填|说明|举例
---|---|-------|----|---
code|string|是|返回码|0:代码成功
msg|string|是|返回消息|
data|string|是|返回数据||
参数示列:
```
{
"code": "01040007",
"msg": "订单已经获取面单,无法作废!订单号:PO2019062100000019",
"data": ""
}
```