Hello, we are making an app for shopify that autoconnects our supplier with the store and updates our stock in shopify based on the data from our supplier. But there is a continuous error in the POST request on this url:
"/admin/api/2022-04/inventory_levels/set.json"
This is an example of how i implemented this:
const url = `${shopDomain}/admin/api/2022-04/inventory_levels/set.json`;
body = {
location_id: 88250745169,
inventory_item_id: 49808594108753,
available: 32,
};
try {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": accessToken,
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`Error fetching: ${response.statusText}`);
}
} ... and more ...
I know for sure that my data in body is correct, because I first fetched this:
/admin/api/2024-01/inventory_levels.json?location_ids=88250745169
which gave me this:
{
inventory_item_id: 49808594108753,
location_id: 88250745169,
available: 7,
updated_at: '2023-12-12T12:13:05+01:00',
admin_graphql_api_id: 'gid://shopify/InventoryLevel/124653633873?inventory_item_id=49808594108753'
}
I get the error Error fetching: Not Found which I think is very strange…
Can someone please help me?