General Data Sync API Solution
General Api solution for partners to Synchronize data with Lenovo,read API Access Process first
request address
common request parameters
before calling business data api, obtain access token first
parameter location | parameter name | description | remark |
---|---|---|---|
Http Method | follow REST API specification | create:POST、update:PUT、delete:DELETE、full cover:PATCH(remove history, then insert current batch data) | |
- | - | - | - |
Header | Authorization | Bearer + space + Token | Bearer aaf0d4d6-c541-34cd-a4e0-03da1cc4019d |
Header | Content-Type | data format: json/xml | application/json (default) application/xml |
Header | Accept | client accept format: json/xml | application/json (default) application/xml |
- | - | - | - |
Url Path | data_category | data category | refer to specific data interface URL |
Url Path | biz_key | business key | refer to specific data interface URL |
common request parameters
parameter location | parameter name | required | type | length | description |
---|---|---|---|---|---|
Body | appName | String | 10 | partner name | |
Body | batch_id | Y | String | 16 | generated by partner, need to ensure the uniqueness |
Body | batch_size | Y | Number | --- | total data size of this batch |
Body | seq_id | Y | String | sequence no | |
Body | seq_size | Y | Number | --- | transmit data size per request 500 >= size >= 1 |
common response parameters
parameter location | name | required | type | format | description | sample |
---|---|---|---|---|---|---|
Body | code | Y | String | --- | process status | "0" stands for success, other code please refer to universal code description |
Body | msg | N | String | --- | process message | error message if failed |
Body | result | N | object/array | --- | request body | refer to response sample |
request sample
https://api-cn-t.lenovo.com/uat/v1.0/supply_chain/scc_data_pipeline/push/lcfc/DemoData
Header Authorization = Bearer aaf0d4d6-c541-34cd-a4e0-03da1cc4019d
json
json
{
"batch_id": "LCFC202206230001",
"batch_size": "250000",
"seq_id": "1",
"seq_size": "2",
"data": [
{
"LENOVO_PN": "SD10W87241",
"PLANT": "H121",
"QTY": "1000"
},
{
"LENOVO_PN": "SD10W87241",
"PLANT": "H121",
"QTY": "1000"
}
]
}
xml
xml
<?xml version="1.0" encoding="UTF-8" ?>
<Req>
<batch_id>LCFC202206230001</batch_id>
<batch_size>250000</batch_size>
<seq_id>1</seq_id>
<seq_size>2</seq_size>
<data>
<LENOVO_PN>SD10W87241</LENOVO_PN>
<PLANT>H121</PLANT>
<QTY>1000</QTY>
</data>
<data>
<LENOVO_PN>SD10W87241</LENOVO_PN>
<PLANT>H121</PLANT>
<QTY>1000</QTY>
</data>
</Req>
- response sample
json
json
{
"code": "0",
"msg": "request success"
}
xml
xml
<Resp>
<code>0</code>
<msg>request success!</msg>
<result>request success!</result>
</Resp>
- exception sample
json
json
{
"code": "E00V00",
"msg": "data verification failed!",
"result": [{
"row": {
"odm": "LCFC",
...
},
"verify": [{
"type": "value length exceed",
"fields": "version"
}]
}]
}
xml
xml
<Resp>
<code>E00V00</code>
<msg>data verification failed!</msg>
<result>
<verify>
<type>value length exceed</type>
<fields>version</fields>
</verify>
<row>
<odm>LCFC</odm>
...
</row>
</result>
<result>
<verify>
<type>value length exceed</type>
<fields>version</fields>
</verify>
<row>
<odm>LCFC</odm>
...
</row>
</result>
</Resp>
Universal code description
location | value | description |
---|---|---|
httpcode | 200 | normal |
httpcode | 401 | Token error |
httpcode | 404 | request resource not exists |
httpcode | 500 | server error |
body.code | "0" | success |
body.code | "-1" | application unexpected exception |
body.code | "E00A00" | current sequence data has been processed successful, |
body.code | "E00V00" | data verification failed, check the result to locate detail infomation |
body.code | "E00W00" | write error, unique constraints violated |
body.code | "E00M00" | multi error exists, need to check result in reponse |