As title says, I can easily POST changing inventory level through REST API (/inventory_levels/set.json) using Postman, but when it spits out error 400 Required parameter missing or invalid when running on Flow.
(note that this HTTP request is placed after for loop)
And here’s the error I received from Flow:
{"status":400,"response_body":"{\"errors\":{\"inventory_item_id\":\"Required parameter missing or invalid\"}}","verb":"POST","url":"https://core.sfe.shopifyinternal.com/admin/api/2024-01/inventory_levels/set.json","request_body":"\n{\"location_id\":84988625182,\"inventory_item_id\":47947386061086,\"available\":41}"}
Which is funny because that “inventory_item_id” is exactly the same as the one I sent from Postman.
I also tried not using any liquid when sending the HTTP request from flow, but it still spits out the same error.
Looking at your error, it looks like your request is prefixed with a “\n”, likely from the “assign” line if your liquid adding a newline. Replacing {% %} with {%- -%} will remove newlines when evaluating Liquid.
{"status":400,"response_body":"{\"errors\":{\"inventory_item_id\":\"Required parameter missing or invalid\"}}","verb":"POST","url":"https://core.sfe.shopifyinternal.com/admin/api/2024-01/inventory_levels/set.json","request_body":"{\"location_id\":84988625182,\"inventory_item_id\":47947386061086,\"available\":41}"}
I also tried wrapping the location and inventory_item’s id with double quote, that also didn’t help.
I double-checked my token but it’s correct; Postman can send the same payload with the same token.