Update Stocklevel doesnt work

silurisiluri Member Posts: 9

Hello, we cannot update the stocklevel anymore.

We use single variant update: PUT http://api.webshopapp.com/en/variants/216632401.json

and response is stocklevel zero

We used bulk update: PUT http://api.webshopapp.com/en/variants/bulk.json

got 405 Method READ not allowed.

I guess there is an issue in the api - please check that.


  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 255 moderator
    edited February 25

    Hi @siluri,

    Thank you for contacting us.

    I've just checked it and can update the variants in bulk. Below you'll find my payload: Are you sure you are doing a PUT?

        "variant": [
                "id" : 216632401,
                "stockLevel" : 10
                "id" : 216632397,
                "stockLevel" : 10

    Can you check if this is working for you?

  • silurisiluri Member Posts: 9

    Yes iam sure and i have checked that.

    • We use axios with method PUT
    • Please also check single update variant
  • silurisiluri Member Posts: 9

    here we check the stocklevel with

    console.log(variant.stockLevel); === 1

    sen we send to the server

      method: 'PUT',
      data: qs.stringify({
        variant: {
          stockLevel: variant.stockLevel
      headers: {

    with correct URL and AUTH.

    baseURL: `http://api.webshopapp.com/en/`,
    url: `/variants/${variant.id}.json`,

    But that doesnt update stocklevel - we got following response

    1. variant: {id: 216632401, createdAt: "2020-02-25T10:02:27+01:00", updatedAt: "2020-02-25T14:26:11+01:00",…}
    2. id: 216632401
    3. createdAt: "2020-02-25T10:02:27+01:00"
    4. updatedAt: "2020-02-25T14:26:11+01:00"
    5. isDefault: false
    6. sortOrder: 1
    7. articleCode: "SCN01S"
    8. ean: ""
    9. sku: ""
    10. hs: null
    11. unitPrice: 0
    12. unitUnit: null
    13. priceExcl: 16.7227
    14. priceIncl: 19.9
    15. priceCost: 0
    16. oldPriceExcl: 0
    17. oldPriceIncl: 0
    18. stockTracking: "enabled"
    19. stockLevel: 0

  • silurisiluri Member Posts: 9

    Is that a bug or not? How can we fix the problem?

  • BrianSmeedeBrianSmeede Member Posts: 1
    edited March 3

    Post edited by BrianSmeede on
  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 255 moderator

    Hi @siluri and @BrianSmeede,

    Thank you for reaching out to us.

    • Are you sure this is an eCom only shop and NOT an Omni Shop?
    • I see that you are using http have you tried https

    Can you check this for me?

  • silurisiluri Member Posts: 9

    cannot chekc that by https because we use it local

    i dont know the difference we use https://siluri.webshopapp.com/admin/

  • silurisiluri Member Posts: 9

    dont get any solution.

  • LeahLeah Moderator, Lightspeed Staff Posts: 176 moderator

    Hi @siluri I've tested and can confirm that there is no bug with updating variant stock levels. There is likely an issue with your code that is not sending the correct value to the API. Have you tried sending the request with cURL or using an API testing tool like Postman? Is your request working this way? If you want, you can PM me the ID of the shop and I can confirm that stock levels can be updated via the API for this shop/variant.

    API Support
    Lightspeed HQ
  • silurisiluri Member Posts: 9

    Thanks but I wouldn't go to the trouble of making a contribution here if I hadn't done so before.

    cannot update the stocklevel.

  • silurisiluri Member Posts: 9

    Used PUT but get READ error.

    This is definitely a bug on the server side

  • LeahLeah Moderator, Lightspeed Staff Posts: 176 moderator

    Hi @siluri I'm going to PM you so I can get information that allows me to take a look at your shop and this product in particular and see if I can figure out why you're getting this error, since I can't reproduce it on my test shops.

    API Support
    Lightspeed HQ
  • LeahLeah Moderator, Lightspeed Staff Posts: 176 moderator

    Hi @siluri I've got an explanation for what is happening.

    Firstly, as is seen in the screenshot you shared of the postman request to the variant endpoint, you are sending the request via http and not https. Lucien mentioned that this might be causing the problem, and it is. I can't see the exact request you're sending to the bulk endpoint but I assume it is also an http request, since https requests to the bulk endpoint are working.

    The current behaviour of these endpoints is that if you try to update via http, rather than https, the API will return the data at the endpoint, but not update the object.

    In other words, if you try a PUT over http, you will get the result of a GET. So, because the bulk endpoint does not allow GET, you are receiving that read error.

    I will file a request to change the way this is handled, to have an error message provided rather than returning the result of a GET. I will also file bug report for that unexpected response at the bulk endpoint, since that is a related but somewhat separate issue.

    In the meantime, using https requests will allow you to update variants at these endpoints.

    API Support
    Lightspeed HQ
  • silurisiluri Member Posts: 9
    edited March 23

    ok thanks, this works. But dont work for me, because we use CORS.js for our local inventury app. do u have a solution for that?

Sign In or Register to comment.