General data push API solution
Unified API solution for Lenovo to push data to partners
TIP
- Use HTTPS as transport protocol, default POST request
- The API follows the REST style and uses JSON as the message transmission protocol by default
- Pay attention to the UrlEncode situation
- Interface limit: RequestBody is less than 500 by default and less than 1Mb -Default timeout 60s
- The domain name recommendation is standard 443, other security may reject the firewall
Partners provide data push receiving addresses
Example
Environment | URL |
---|---|
Test | https://api.******.com/uat/v1.0/scc/data/sync/{data_category}/{biz_key} |
Official | https://api.******.com/v1.0/scc/data/sync/{data_category}/{biz_key} |
Support authentication method
Select your authentication method and provide targeted authentication configurations
Basic Auth
-username -password
OAuth 2.0 - Client Credentials
-clientld -clientSecret -authPath
OAuth 2.0 - Password Credentials
-clientld -clientSecret -authPath -username -password
Public request parameters
Before calling, please obtain Token first
Parameter location | Parameter name | Description | Remarks |
---|---|---|---|
Http Method | Follow REST API specifications | Add: POST, modify: PUT, delete: DELETE, full coverage: PATCH (clear historical data, then write current data) | |
- | - | - | - |
Header | Authorization | Determined based on authentication method | Bearer aaf0d4d6-c541-34cd-a4e0-03da1cc4019d |
- | - | - | - |
Url Path | data_category | Data classification | Refer to the specific data interface URL |
Url Path | biz_key | Business keyword | Refer to the specific data interface URL |
Public request parameters
Position | Name | Required | Type | Length | Description |
---|---|---|---|---|---|
Body | batch_id | Y | String | 16 | Batch ID, generated by partners to ensure batch uniqueness |
Body | batch_size | Y | Number | --- | Total amount of data in the batch |
Body | seq_id | Y | String | Within the batch, each sequence number | |
Body | seq_size | Y | Number | --- | Each time, the amount of data to be pushed 500 >= size >= 1 |
Public response parameters
Location | Name | Required | Type | Format | Description | Example |
---|---|---|---|---|---|---|
Body | code | Y | String | --- | Status code | "0" represents success, other failures can refer to the return code |
Body | msg | N | String | --- | Prompt message | If it is not "0", an error message will be prompted |
Body | result | N | object/array | --- | data body |
Request example
URL
:https://api.******.com/uat/v1.0/scc/data/sync/odm/master_data
Header
:Authorization = Bearer aaf0d4d6-c541-34cd-a4e0-03da1cc4019d
Request parameters
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"
}
]
}
- Response example
json
{
"code": "0",
"msg": "request success"
}
- Exception examples
json
{
"code": "E00V00",
"msg": "data verification failed!",
"result": [
{
"row": {
"odm": "LCFC",
...
},
"verify": [
{
"type": "value length exceed",
"fields": "version"
}
]
}
]
}
General error code description
Parameter position | Value | Description |
---|---|---|
httpcode | 200 | Normal return result |
httpcode | 401 | Token error/Signature error |
httpcode | 404 | The accessed path does not exist |
httpcode | 500 | Server error |
body.code | "0" | Success |
body.code | "-1" | System error |
body.code | "E00A00" | The sequence data has been successfully consumed |
body.code | "E00P00" | Retry to reach upper limit |
body.code | "E00V00" | Packet verification failed, details will be reflected in the result |
body.code | "E00W00" | Write exception, unique constraint violation |
body.code | "E00M00" | Multiple exceptions, the result contains multiple codes and messages |