平方下一批需要的令牌项目

时间:2018-09-12 06:20:12

标签: api square square-connect

当我尝试通过Square API v1检索所有项目时,我只需要知道如何获取下一页令牌,因为现在我有一个客户的项目超过1000,因此我无法全部检索即使我没有得到下一页令牌,也可以再次请求下一页。

我正在通过GET /v1/{location_id}/items使用简单的curl请求  但我没有得到下一页令牌ID,因此可以发出下一个请求。

即使我使用SDK PHP通过listItems端点获取项目,也没有在响应数组中找到批处理令牌来再次调用下一页。

//Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('sq0atp-xxxxxxxxxx');`

$api_instance = new SquareConnect\Api\V1ItemsApi();
$location_id = "xxxxxxxx"; // string | The ID of the location to list items for.
$batch_token = ""; // string | A pagination cursor to retrieve the next set of results for your original query to the endpoint.

try {
    $result = $api_instance->listItems($location_id, $batch_token);
    // inside this result array i didn't have batch token cursor but i get the record 999 array elements of my items 
    echo '<pre>$items results';
        print_r($result);
    echo '</pre>';


} catch (Exception $e) {
    echo 'Exception when calling V1ItemsApi->listItems: ', $e->getMessage(), PHP_EOL;
}

0 个答案:

没有答案