Shopfy REST API inventory level set (and adjust) does not work

New Member
8 0 0

Hello I am usind PHP curl in order to manage my inventory with Shopify.

Everthing workd fine except for inventory levels. For example:


    $url = "";
            "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); 


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?

Replies 0 (0)