Required parameter missing or invalid

Required parameter missing or invalid

black-hat
Shopify Partner
2 0 0

 

I am developing a Shopify App using Remix. When I call the Shopify REST API from the Remix template, I encounter the following error:

{"errors":{"redirect":"Required parameter missing or invalid"}}

Below is the code snippet I am using:

const response = await admin.rest.post({
path: "admin/api/2024-07/redirects.json",
body: JSON.stringify({
redirect: {
path: alias ? `/${alias}` : "/default-alias",
target: targetUrl || "https://black-hat1.myshopify.com/products/acrylic-charms-manufacturer"
}
}),
headers: {
'Content-Type': 'application/json'
}
});

const responseJSON = await response.json();
return json({ response: responseJSON });

Interestingly, the same API call works perfectly fine when tested in Postman. However, I receive the "Required parameter missing or invalid" error when making the request through the Remix application.

If anyone has insights or suggestions on resolving this issue, your assistance would be greatly appreciated.



Replies 0 (0)