Development discussions around Shopify APIs
Hello I am usind PHP curl in order to manage my inventory with Shopify.
Everthing workd fine except for inventory levels. For example:
$url = "https://app:pwd@url.myshopify.com/admin/api/2021-10/inventory_levels/set.json";
$data_json=json_encode(
array(
"inventory_levels/set" => array(
"location_id" => $idlocation,
"inventory_item_id" => $invitem,
"available" => $qty
)
),
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json)));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
I am pretty sure $idlocation, $qty and $invitem are valid real data, I verified that $invitem is an actual integer representing an id of an inventory_item_id.
The response I get (even trying with different approachs) is:
string(72) "{"errors":{"inventory_item_id":"Required parameter missing or invalid"}}"
What does it mean? And how I do pass a valid parameter?
User | RANK |
---|---|
6 | |
5 | |
5 | |
5 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022