Page 1 of 1

Retrieve Items in Stock

Posted: Mon Jun 26, 2023 6:48 am
by rohan
I'm trying to retrieve items in stock via the API, specifically higher value items.
I am able to retrieve items in a storage device through the API fine, however I do not appear to be able to use the orderby parameter to sort by InventoryValue (or Name/ID) using ?orderby=InventoryValue

I suppose I could pull down a list of all items in stock and sort it programatically, however the maximum page size is 250 - is there a way to retrieve the total number of items in a storage device so I could calculate how many pages i would need to pull?

Re: Retrieve Items in Stock

Posted: Mon Jun 26, 2023 11:47 pm
by Sindre
Hi rohan,
The stock items is not supporting the orderby parameter. If you wish to retrieve the higher value items you can filter based on a minimum amount. For example 300 as seen below and it will return all items with Inventory value 300 and higher.

Code: Select all

/api/v1.0/companies/{companyID}/storageDevices/{storageDeviceID}/stock/?InventoryValue=ge(300)
If you wish to see the number of results of your list and also the number of pages you need to retrieve this is all available in the result header. Here you can find 'result-total' and 'result-pages'.

I hope this helps.

Regards

Re: Retrieve Items in Stock

Posted: Tue Jun 27, 2023 6:24 am
by rohan
Thanks for the reply. Your suggestions have helped me greatly.
The documentation indicates that you can orderby.
https://developer.simprogroup.com/apido ... tock-Items

Re: Retrieve Items in Stock

Posted: Wed Jun 28, 2023 4:49 am
by Sindre
Hi,
I'm glad you could improve your query.

I see that the documentation includes orderby. We will look into the possibility of adding the sorting or if we need to update the documentation.

Thank you for raising this.

regards