Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi, I have been trying for many hours trying to send a flow request that lessens an inventory item by 1. The request is successful according to Shopify Flow however my inventory remains unaffected. This means that my api key and query format must be correct however maybe I am missing something or my syntax is off. Totally stumped on this. If anyone has any ideas, would really appreciate any help
I referenced the following to build a query
https://help.shopify.com/en/manual/shopify-flow/reference/actions/send-http-request
and
{"query": "mutation {inventoryAdjustQuantity(input:{inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\" availableDelta: -1}){inventoryLevel {available}}}"}
Solved! Go to the solution
This is an accepted solution.
Hey Paul, thanks for getting back to me, really appreciate it. The error previously was
{"status":400,"response_body":"Bad Request","verb":"POST","url":"https://mystore.myshopify.com/admin/api/2023-07/graphql.json","request_body":"mutation {\n inventoryAdjustQuantity(\n input:{\n inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\"\n availableDelta: -1\n }\n )\n {\n inventoryLevel {\n available\n }\n }\n }"}
however there were no errors on the query I posted initially in my question, hence my confusion.
I actually figured out how to achieve what I wanted however. I ended up using the URL:
https://mystore.myshopify.com/admin/api/2023-07/inventory_levels/adjust.json
along with a much simpler JSON that seems to do the trick
{"location_id": 73357459772, "inventory_item_id": 48137018704188, "available_adjustment": -1}.
Perhaps you could shed some light on the difference of using graphql vs adjust.json as urls to POST to? I really didn't understand why it seemed like there were more than one way to accomplish the same thing (using the documentation I posted above). Thanks again
Have you looked at the workflow run log to see if there is an error? If so, what does it say?
This is an accepted solution.
Hey Paul, thanks for getting back to me, really appreciate it. The error previously was
{"status":400,"response_body":"Bad Request","verb":"POST","url":"https://mystore.myshopify.com/admin/api/2023-07/graphql.json","request_body":"mutation {\n inventoryAdjustQuantity(\n input:{\n inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\"\n availableDelta: -1\n }\n )\n {\n inventoryLevel {\n available\n }\n }\n }"}
however there were no errors on the query I posted initially in my question, hence my confusion.
I actually figured out how to achieve what I wanted however. I ended up using the URL:
https://mystore.myshopify.com/admin/api/2023-07/inventory_levels/adjust.json
along with a much simpler JSON that seems to do the trick
{"location_id": 73357459772, "inventory_item_id": 48137018704188, "available_adjustment": -1}.
Perhaps you could shed some light on the difference of using graphql vs adjust.json as urls to POST to? I really didn't understand why it seemed like there were more than one way to accomplish the same thing (using the documentation I posted above). Thanks again
REST is easier in that action for sure. Shopify supports 2 Admin APIs (REST vs GraphQL). The latter is generally preferred because it allows traversing a graph better than REST and allows you to only request the data you need.
Thanks Paul for your help