Stock Entries PUT request body gives me a lint error

I am trying to make an update to inventory by using the Stock entries PUT request. I receive a lint error when I put the request body given in the API docs. Is there something I am missing?

Error: Expecting ‘STRING’, got ‘}’

  {
            "stock_entry": {
                "physical_stock_level":  202,
                "infinite": false,
                "location": "My Location",
            }
        }

Hi @jacrim!
The request looks fine! I believe it’s the content-type you’re sending.

Please ensure that the Content-Type is set to application/json as described here: API Docs - Veeqo Developers

Thanks,
Kris.

Thanks Kristien for the reply! I did successfully commit a PUT request to Stock Entry. I ran it in the Veeqo console. That strange thing is not matter what I put in for the request QTY it returns the original QTY. Is there a field I am missing?

Request body

{
    "stock_entries": [
      {
        "sellable_id": 121796160,
        "warehouse_id": 81914,
        "infinite": false,
        "allocated_stock_level": 0,
        "stock_running_low": false,
        "incoming_stock_level": 0,
        "transit_outgoing_stock_level": 0,
        "warehouse": {
          "id": 81914,
          "name": "My Location",
          "display_position": 9999
        },
        "physical_stock_level": 202,
        "available_stock_level": 202,
        "sellable_on_hand_value": 0,
        "transit_incoming_stock_level": 0,
        "location": {}
      }
    ]
}

Response Header

cache-control:max-age=0, private, must-revalidate
content-type:application/json; charset=utf-8
date:Fri, 04 Aug 2023 14:39:45 GMT
etag:W/"c317c06d3afcf732f72dcdbd69cedb96"
referrer-policy:strict-origin-when-cross-origin
server:nginx/1.21.6
strict-transport-security:max-age=31536000; includeSubDomains
via:1.1 b2179245b8d8ae2b245dd8946895eb1e.cloudfront.net (CloudFront)
x-amz-cf-id:nj90NfCMyOQkyuk5ARFuCsdEfYBN-l3bMS5JPdUWcCsKwOG_j8sS7g==
x-amz-cf-pop:IAD55-P1
x-cache:Miss from cloudfront
x-content-type-options:nosniff
x-download-options:noopen
x-frame-options:SAMEORIGIN
x-permitted-cross-domain-policies:none
x-request-id:9038ecfafb0f6e912879e06290a024c4
x-runtime:0.103427
x-xss-protection:1; mode=block

Return Body

{
  "sellable_id": 121796160,
  "warehouse_id": 81914,
  "infinite": false,
  "allocated_stock_level": 0,
  "stock_running_low": false,
  "updated_at": "2023-08-02T19:59:49.153Z",
  "incoming_stock_level": 0,
  "transit_outgoing_stock_level": 0,
  "warehouse": {
    "id": 81914,
    "name": "My Location",
    "display_position": 9999
  },
  "physical_stock_level": 200,
  "available_stock_level": 200,
  "sellable_on_hand_value": 0,
  "transit_incoming_stock_level": 0,
  "location": null
}

Hi, @jacrim!
Are you using the correct endpoint?

The request you’re sending should be sent to:

https://api.veeqo.com/sellables/121796160/warehouses/81914/stock_entry

Can you try a simpler request? Such as:

{
  "stock_entry": {
    "physical_stock_level": 202
  }
}

I’ve tried this on my testing account and I had success, and it returned the correct stock figure. You can test it using Build, Collaborate & Integrate APIs | SwaggerHub also.

I believe it isn’t working in this case because you’ve added attributes in your request that are not allowed to be updates such as warehouse

Hope this helps!
Thanks,
Kris.

1 Like

Thanks Kristien! The simpler body request worked. I appreciate the tip about how to test on SwaggerHub as well