Grocy: Dev question: API stock response with location filter

Created on 30 Nov 2020  路  3Comments  路  Source: grocy/grocy

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. :-)

enhancement

Most helpful comment

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

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gruessung picture gruessung  路  3Comments

jayaddison picture jayaddison  路  5Comments

yarons picture yarons  路  4Comments

dilshandiss picture dilshandiss  路  5Comments

shadow7412 picture shadow7412  路  5Comments