Hi, on the server website it's possible to filter for a specific location in stock overview.
After that, only products with stock at the selected location are shown.
Can I do this with the API too? In the /stock response I cannot see the locations at which a product has stock.
The only way I see is to do a /stock/products/{productId}/entries for every product...
Thanks!
Edit: Maybe this has to be marked as a feature request if it's currently not possible. :-)
The stock overview page does this by that all locations, where the product is currently in stock, are written into a hidden column and the filter is then just a search over that column.
You can get those locations by /stock/products/{productId}/locations.
Would be also a request per product.
Let's extend the endpoints /stock/products/{productId}/locations and /stock/products/{productId}/entries somehow to allow getting all entries/locations with one request (both have the new filter capabilities of the next version, so maybe just removing the {productId} argument is enough - but that doesn't really fit together with the include_sub_products query parameter...).
The underlying SQL view stock_current_locations is now available via the "Generic entity interactions" endpoints (no edit, only listing).
The same goes for the stock entity/table - the "raw" stock entries.
Hope this helps for what you thought of... 馃檪
https://demo-prerelease.grocy.info/api/objects/stock
https://demo-prerelease.grocy.info/api/objects/stock_current_locations
Thank you very much!
Most helpful comment
The underlying SQL view
stock_current_locationsis now available via the "Generic entity interactions" endpoints (no edit, only listing).The same goes for the
stockentity/table - the "raw" stock entries.Hope this helps for what you thought of... 馃檪
https://demo-prerelease.grocy.info/api/objects/stock
https://demo-prerelease.grocy.info/api/objects/stock_current_locations