Skip to content

ddon-90/demo.api-wrapper

Repository files navigation

Name:

Update Inventory and Price by RefId

Description:

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

How to demo:

  1. Clone/Download this repository and open it with a code editor of your choice, eg. VSCode

  2. Open the terminal and login to your VTEX account

vtex login {{account}}
  1. Create a new development workspace or use an existing one
vtex use {{workspace}}
  1. Add the account name as the vendor on manifest.json file
{
  "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",
  ...
  ...
}
  1. Link the project
vtex link
  1. After the linking, open Postman and make some API calls

Update Price

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"
      }
    }
  ]
}

Update Inventory

PUT
https://{{workspace}}--{{account}}.myvtex.com/_v/api/inventory/skus/:refId/warehouses/:warehouseId

Request Body:
{
  "unlimitedQuantity": false,
  "dateUtcOnBalanceSystem": "null",
  "quantity": 106
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors