i can not able to get page_info using shopify Api

非 Y 不嫁゛ 提交于 2020-04-17 22:51:31

问题


I am doing Shopify versioning in that I can not get page wise data. I review API new version in that I show page_info where to I get page_info

$api_url = 'https://6b4c824f22b4f24ddewwerew0a9b36397fd27e5c4:a5cb5dd808ec7392ewrewrwerwerwed8872be5aa5d3b1c@bacsolution-4.myshopify.com/admin/api/2020-01/products.json?limit='.$limit.';rel=next';


    //$api_url = 'https://'.$shop.'/admin/products.json?limit='.$limit.'&page='.$i.'';
    //$fieldstoselect = 'id,title,variants';
    $fieldstoselect = 'id,title';
    $api_url = $api_url.'&fields='.$fieldstoselect;

    $headr = array();
    $headr[] = 'Content-Type: application/json';
    //$headr[] = 'X-Shopify-Access-Token:'.$token;
    $ch = curl_init($api_url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    $res = curl_exec($ch);
    $response_all = json_decode($res);
    echo "<pre>";
    print_r($response_all);
    exit;

回答1:


If you are using REST API then you will get it in the response header. have a look in below screenshot of response header.

And below post might help you on how to extract this pageInfo from response header

How to create pagination in shopify rest api using php



来源:https://stackoverflow.com/questions/60151568/i-can-not-able-to-get-page-info-using-shopify-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!