小编Alp*_*pha的帖子

Shopify REST API 分页链接为空

情况

我正在尝试调用Shopify REST API,其中有超过 50-250 个结果,但我无法从包含Pagination Links 的cURL Response 中获取链接标头。

Cursor-Pagination API 文档中的链接标头示例( https://shopify.dev/tutorials/make-paglated-requests-to-rest-admin-api )

#...
Link: "<https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={next}, <https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={previous}"
#...
Run Code Online (Sandbox Code Playgroud)

链接rel参数确实显示,但链接为空,如下所示。

这是根据我的 PHP 代码

我的 Shopify 通话功能

function shopify_call($token, $shop, $api_endpoint, $query = array(), $method = 'GET', $request_headers = array()) {
    
    // Build URL
    $url = "https://" . $shop . ".myshopify.com" . $api_endpoint;
    if (!is_null($query) && in_array($method, array('GET',  'DELETE'))) $url = $url . "?" . http_build_query($query);
    
    $headers = [];
    
    // Configure cURL
    $curl …
Run Code Online (Sandbox Code Playgroud)

php curl shopify php-curl shopify-api

1
推荐指数
1
解决办法
2578
查看次数

标签 统计

curl ×1

php ×1

php-curl ×1

shopify ×1

shopify-api ×1