Temu Stock Update
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | 29.01.2024 | Bogomil | First publish |
The stock update is used to edit the stock information of specified products. By providing the product ID and the new stock quantity, merchants can update the product stock records, ensuring the accuracy and timeliness of stock information.
All triggers, validations etc are as per abstraction - Stock Update general requirements
Update Stock
Please note all stock updates are happening via Temu’s own IDs.
First they are always grouped per goodsId
(or in other words per variation since one variation group in Hemi will have the same goodsId
on each item). And then stock per product are provided by the skuId
which is Temu’s own single product ID
After examination of docs and examples it seems we can send only one goodsId
at a time so that’s how we will start. We want to select only the changed SKUs within a variation as well so essentially we want to select all pending changes, group by goodsId and then fire away 1 by 1
Please note - there is an option we are missing an example or something that we can send multiple objects in an array. In any such case we will change up the structure but the logic for selection will remain
API Call : POST https://openapi-b-eu.temu.com/openapi/router
API Name: bg.local.goods.stock.edit
Please don’t forget that the call itself is to be used based on the value of Channel > Country
as described here: ‼ Please note that the above is true for all calls. In each call we will give the endpoint with an example host but we need to use the correct domain pointer based on the Channel > Country
value ‼
Find a request sample with params below :
{
"type": "bg.local.goods.stock.edit",
"timestamp": timestamp,
"app_key": "app_key",
"data_type": "JSON",
"access_token": "access_token"
}
Sample Body
[
{
"goodsId": "604269868588112",
"skuStockTargetList": [
{
"stockTarget": 1,
"skuId": "58224724203874"
},
{
"stockTarget": 2,
"skuId": "58224724203874"
}
]
}
]
Request mapping :
Temu Field | Hemi Field | Required | Comment | |
---|---|---|---|---|
goodsId |
Product Account > Channel Item Id | Yes | ||
skuStockTargetList |
||||
stockTarget |
Product Account > Quantity | Yes | ||
skuId |
Product Account Temu > SKU Id | Yes | New Field which should be available for import |
Example success response 200:
{
"result": {
"msg": null,
"operateResult": true,
"goodsId": 604367042254005,
"skuStockEditStatusInfoList": [
{
"stockEditStatus": true,
"skuId": 55613384045069
},
{
"stockEditStatus": true,
"skuId": 67398774303169
}
]
},
"success": true,
"requestId": "eu-5f18eb48-2c34-41c0-a40b-b4a68ce519da",
"errorCode": 1000000,
"errorMsg": ""
}
Example partial error response 200:
{
"result": {
"msg": null,
"operateResult": true,
"goodsId": 604367042254005,
"skuStockEditStatusInfoList": [
{
"stockEditStatus": true,
"skuId": 67398774303169
}
]
},
"success": true,
"requestId": "eu-2f7ab92d-d4cd-464e-b196-fe700e915af0",
"errorCode": 1000000,
"errorMsg": ""
}
Example error response 200:
{
"success": false,
"requestId": "eu-f67175d0-1f04-428a-8014-aea1eb5be45c",
"errorCode": 7000000,
"errorMsg": "BUSINESS_SERVICE_ERROR"
}
Example error response 200:
{
"result": {
"msg": null,
"operateResult": false,
"goodsId": null,
"skuStockEditStatusInfoList": []
},
"success": true,
"requestId": "eu-e0a70f87-36be-4620-b91f-4cdd38de59f1",
"errorCode": 1000000,
"errorMsg": ""
}
Example error response 400:
{
"success": false,
"requestId": "eu-df0a8eb7-e171-4551-854e-31734e955450",
"errorCode": 4000006,
"errorMsg": "parameters type is error, please check your input parameters."
}
The responses are really shit and the only way we can check if the update is successful is when we have "operateResult": true
and we have the skuID in the skuStockEditStatusInfoListthis
one this indicates that the operation was successful and we want to treat this as success.
In all other cases we will treat the update as error and in Product Account > Update Quantity Error
we want to store both the errorCode
and errorMsg
because in some cases we may not have errorMsg
.
In a case of partial success or partial error response we wont receive any error message thus we want to add our internal error in this case - “Stock update was not successful”