Search code examples
phpcurlsquare-connect

Square Connect API cURL call limits Inventory results


When I make my cURL call to get the variation id and current quantities from my inventory using:

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Bearer PERSONAL_ACCESS_TOKEN' ));
    curl_setopt ($curl, CURLOPT_URL, "https://connect.squareup.com/v1/me/inventory/");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    if(!curl_exec($curl)){
        die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
    }
    $ch = curl_exec ($curl);
    curl_close ($curl);
    $ch = json_decode($ch, true);
    $c = count($ch);

$c = 299, so that's a limit of 300 items it is returning. I have well over 1,000 items in my inventory.

Is 300 the limit for this call or am I doing something wrong?


Solution

  • I made a mistake when adding new items. I didn't enable inventory tracking on the web portal when I added them. I just tested this by enabling some additional items' inventory tracking and my count went up.