Update Inventory and Price by RefId
Custom API wrappers to allow inventory and price updates using the SKU RefId.
Exposed routes:
"routes": {
"updatePrice": {
"path": "/_v/api/pricing/prices/:refId",
"public": true
},
"updateInventory": {
"path": "/_v/api/inventory/skus/:refId/warehouses/:warehouseId",
"public": true
}
}
Note: The behaviour of these APIs is the same as the Create or Update Base Price or Fixed Prices and Update inventory by SKU and warehouse API with the only difference that you need to use the SKU Reference ID instead of the SKU ID
-
Clone/Download this repository and open it with a code editor of your choice, eg. VSCode
-
Open the terminal and login to your VTEX account
vtex login {{account}}
- Create a new development workspace or use an existing one
vtex use {{workspace}}
- Add the account name as the vendor on
manifest.jsonfile
{
"name": "api-wrapper",
"vendor": "{{account}}",
"version": "0.0.1",
"title": "API Example",
"description": "Example of new REST APIs built on top of VTEX IO.",
"mustUpdateAt": "2018-01-04",
...
...
}
- Link the project
vtex link
- After the linking, open Postman and make some API calls
PUT
https://{{workspace}}--{{account}}.myvtex.com/_v/api/pricing/prices/:refId
Request Body:
{
"markup": null,
"listPrice": 399,
"basePrice": 299,
"costPrice": 100,
"fixedPrices": [
{
"tradePolicyId": "1",
"value": 199,
"listPrice": 299,
"minQuantity": 1,
"dateRange": {
"from": "2023-09-07T00:00:00+01:00",
"to": "2023-09-09T23:59:59+01:00"
}
}
]
}
PUT
https://{{workspace}}--{{account}}.myvtex.com/_v/api/inventory/skus/:refId/warehouses/:warehouseId
Request Body:
{
"unlimitedQuantity": false,
"dateUtcOnBalanceSystem": "null",
"quantity": 106
}