Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm making a request to the endpoint:
https://###.myshopify.com/admin/api/2021-10/orders/{{order.legacyResourceId}}/fulfillments.json
with the body:
{
"fulfillment":{
"location_id":65503887518,
"tracking_number":"CLICKHERE",
"tracking_urls":[
"{{order.note | replace: 'Cód. de Rastreamento:',''}}"
],
"notify_customer":true
}
}
In Postman everything works perfectly, but in the flow I get the following error:
{"status":406,"response_body":"","verb":"POST","url":"https://###.myshopify.com/admin/api/2021-10/orders/4530109270171/fulfillments.json","request_body":"{\"fulfillment\":{\"location_id\":65503887518,\"tracking_number\":\"CLICKHERE\",\"tracking_urls\":[\" http://tracking.totalexpress.com.br/poupup_track.php?reid=###&pedido=#####&nfiscal=0\n\"],\"notify_customer\":true}}"}
The request is exactly the same. Same headers, same body. The only difference is the dynamic values.
Important note. When I create a manual order and run the flow. Everything works, but when I run the flow in a real product this error happens.
Does your note include characters that might cause issues with json? I’d recommend adding the tag “| json” any time you are trying to output json to make sure it’s escaped.
I checked, it doesn't include, even so I added the “| json”, I keep getting the same error. As I mentioned, when I create a manual order and run the flow everything works. When it's a real order, the flow follows the same flow and I get a 406 on the request.
Assuming it's not that field, the server is not liking something.
I would review this:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406
It suggests that you may not be setting the same headers that are sent via postman. Try sending your request to a URL where you can inspect the output (ngrok or something like https://hookbin.com/) and then compare the headers and inspect the body of the request with the dynamic data.
A second thing to check:
https://###.myshopify.com/admin/api/2021-10/orders/{{order.legacyResourceId}}/fulfillments.json
Are you sure this URL is valid? I'm not sure what action you are trying to do, but I couldn't find any POST in the Shopify REST API that has this URL format...there is a GET request here but that would not work with Flow and your body doesn't match.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024