Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Flow - Send Admin API returns error "invalid JSON"

Flow - Send Admin API returns error "invalid JSON"

SAnderson_GW
New Member
5 0 0

I am trying to use Flow to update various product fields based on certain conditions using the Send Admin API action. To test this I am using an old, inactive product and using a very simple product update mutation but keep getting the following error when it runs: "Ran into exception: Mutation input evaluated to invalid JSON. Please ensure the input forms valid JSON after Liquid code is run."

 

I don't understand why this error is occurring. Please help, I'm at a complete loss. I don't understand . 

 

This is the Flow:

Screenshot 2024-11-12 at 11.40.20.png

 

This is the API request detail: 

Screenshot 2024-11-12 at 11.40.29.png

 

And this is the error/returned data: 

Screenshot 2024-11-12 at 11.40.11.png

 

Thanks in advance.

Replies 4 (4)

bguse
Shopify Partner
20 2 4

i had to google search what flow was. but I think your issue is that your json is formatted incorrectly. 

i think
(ON SALE) - Marloboro - plz guaway - 5.5% (440ml),
should need quotes around it. like
"(ON SALE) - Marloboro - plz guaway - 5.5% (440ml)",
json objects have specific formatting I think that might be your main issue with this error not exactly sure how you can make that happen in an automated way using flow. but I hope that helps

bguse_0-1731417991729.png

 

SAnderson_GW
New Member
5 0 0

Thanks for replying so quickly. I don't think this is the issue. I have run the api call using text and got the same error. 

 

Adjusted mutation input: 

Screenshot 2024-11-12 at 14.05.37.png

 

Error & report: 

Screenshot 2024-11-12 at 14.05.14.png

 

Something else must be the error. 

bguse
Shopify Partner
20 2 4

sorry that previous response didnt help. this looks like it might be more along the lines of what you're doing? 

https://community.shopify.com/c/shopify-flow-app/modifying-product-type-error/m-p/2830038#M6215

this sort of makes sense because it needs to know which product id you are mutating. it doesn't know you want to mutate the product that triggered the flow. (if I am understanding your original photo correctly)

paul_n
Shopify Staff
1430 157 332

This is not the right format for that mutation. Just look at the examples in the docs. https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/productupdate

 

For example, you have nested the media inside the input, which is not correct. 

Also, you are missing some required fields like the product id

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.