post InventoryCountItem

innitsolinnitsol Member Posts: 6

I am testing a post routine for Inventory Count Items. I can do 1 without an issue but when I try to post the second I get a 422 response. Do I need to offset this or am I missing something else?

6 comments

  • gregaricangregarican Member Posts: 511 

    Can you provide a sample of the POST URL and JSON body of both calls?

  • innitsolinnitsol Member Posts: 6

    '{"qty": "800", "inventoryCountID": "124", "itemID": "9766", "employeeID": "25"}'


    https://api.lightspeedapp.com/API/Account/<<AcctID>>/InventoryCountItem.json

  • gregaricangregarican Member Posts: 511 
    edited June 30

    As long as the ID's are valid then it should work. You didn't specify if this was a POST request or a PUT request. The former would create a new record, while the latter would update an existing record.

    So let's say I POST a count for Item #12345. That's the first time it's been touched for the inventory count. Any subsequent counts for Item #12345 need to be PUT requests. Since the item record already exists.

  • innitsolinnitsol Member Posts: 6

    Sorry this is a post request.


    I have a new inventory count setup with no items inside of it. I am getting a 400 response from the system.


    In the end I would like to create a system to put all 4000 items into an inventory count. I am assuming that each item needs to be its own post request.


    I am generating with Python script. Any ideas would be much appreciate.


    Thank you

  • gregaricangregarican Member Posts: 511 

    I'd suggest using a tool like Fiddler can capture at least the first handful of API requests/responses. This will show exactly what your Python script is sending out, and what the Retail API is sending back for responses.

    If each item has its own unique item ID in the requests, then you should be able to POST them one at a time just fine. Although keep in mind Retail's API throttling --> https://community.lightspeedhq.com/en/discussion/28/best-practices. But you'd see 429 errors if that was an issue.

  • innitsolinnitsol Member Posts: 6

    Thank you for the help. In the end I was able to get a python script that imported our 3500 items. It was an interesting challenge with the token refresh time and itemid not being the itemid. It the end I will have to clean up the script. Maybe put a front end on it so that my end users can handle the process next time.

Sign In or Register to comment.