Updating Stock Entry

Hi Guys,
We are trying to push our stock values from our warehouse system to Veeqo, so the correct values can then be shown on the website.
The sellable_id is the parameter show in the API docs, but we need to use the SKU to match the products between the two platforms.
Any suggestions on how we can do this ?
Many thanks in advance for any info

Hi, @dmyers0!
Welcome to the Veeqo developer forum!

There’s no way to update based on SKU’s because the endpoint required the primary ID (sellable_id) - I’d assume this is because multiple sellables could potentially have the same SKU code.

The way I would go about doing this is iterating through products and fetching each of the sellable IDs and building an array that would reference the SKU, then iterating through the array that has been built, and making separate requests to the /sellables endpoint

This is possible using the /products endpoint.

  1. First, make a request to: https://api.veeqo.com/products

    • You will need to also specify page_count and page attributes if you want to get more than 10 products
  2. This will return a response for each product, you will then need to iterate through the “sellable” portion of the response for the products to get the SKU code and sellable IDs for that product.

  3. Then, for each iteration, you can build an array dynamically for each sellable containing the SKU code and Sellable ID.

  4. Finally, Iterate through your newly build array containing each of the SKUs and make your request with the new data you have

Here’s some working PHP code that I’ve written up which would build this array:
($products is the decoded json response from the /products endpoint)

foreach($products as $product){
    foreach($product['sellables'] as $index => $sellable){
        $array[$sellable['sku_code']] = $sellable['id'];
    }
}

This would generate an array with the following structure:

Array (
    [g-dog-2] => 58641795
    [g-dog-1] => 58641794
    [test] => 58519745
    [DG02] => 57991303
    [DG01] => 57991302
    [FLORYEL124] => 57611649
    [FLORYEL123] => 57611648
    [TS001] => 57557816
    [TS002] => 57557817
    [CP003] => 57557780
    [CP3321] => 57557779
    [CP001] => 57557777
    [VQ001] => 57340964
    [IMP01] => 57302068
    [PJ003] => 57301122
)

From this point, you would iterate through the array we’ve built, and make your requests to this endpoint: https://api.veeqo.com/sellables/sellable_id/warehouses/warehouse_id/stock_entry
Make sure you change the relevant fields

I should note, that by doing this through the API, you may encounter some issues with the limits as stated here.

If the limits cause issues, you could always update your stock via .csv. Ben has a really good video guide which you can find here.

Hope this help!

Thanks so much for the detailed response Kristien.
I will check this out with team tomorrow and see if we can get this working.

1 Like

Just to update this thread, we managed it with the approach above.
Many Thanks

That’s great news, @dmyers0!
I’m glad I could help out.