Development discussions around Shopify APIs
I try to make simple call to Shopify API
function testAction($shop_url) { $endpoint = '/admin/api/2019-07/products.json'; $s = curl_init(); curl_setopt($s, CURLOPT_URL, 'https://'.$shop_url.$endpoint.'?limit=1'); curl_setopt($s, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($s, CURLOPT_USERPWD, $apiKey.':'.$password); curl_setopt($s, CURLOPT_RETURNTRANSFER, 1); curl_setopt($s, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($s, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($s, CURLOPT_HEADERFUNCTION, array($this, 'headerLine')); $shopify_response = curl_exec($s); } function headerLine($curl, $header_line) { echo "<br>".$header_line; return strlen($header_line); }
And get this response header
HTTP/1.1 200 OK Date: Tue, 17 Sep 2019 20:41:27 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=d168f958740bb0d267f2a984f725e577b91568752887; expires=Wed, 16-Sep-20 20:41:27 GMT; path=/; domain=.myshopify.com; HttpOnly X-Sorting-Hat-PodId: 52 X-Sorting-Hat-ShopId: 1341227061 Vary: Accept-Encoding Referrer-Policy: origin-when-cross-origin X-Frame-Options: DENY X-ShopId: 1341227061 X-ShardId: 52 X-Stats-UserId: X-Stats-ApiClientId: 2343500 X-Stats-ApiPermissionId: 28783247413 X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40 X-Shopify-Shop-Api-Call-Limit: 1/40 X-Shopify-API-Version: 2019-07 Link: ; rel="next" Strict-Transport-Security: max-age=7889238 X-Request-Id: 4625077c-19e6-4d7e-bbc0-d6816cdce4ef X-Shopify-Stage: production Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopify.cn https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://dme0ih8comzn4.cloudfront.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=4625077c-19e6-4d7e-bbc0-d6816cdce4ef X-Content-Type-Options: nosniff X-Download-Options: noopen X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=4625077c-19e6-4d7e-bbc0-d6816cdce4ef X-Dc: gcp-us-central1,gcp-us-central1 NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001} Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]} Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 517de6aad82d8acc-KBP
As you can see, Link parameter is empty.
Why is it empty, if I set a limit of 1, having 4 products in the store?
Hi @rediskapsts,
Are you writing the headers to a file or a log? We've seen sometimes this can cause the Link headers to be missing as the link is enclosed in chevrons as per the RFC spec of the LINK header. This can cause it to not display correctly if the log/page interprets html coding. If this is not the case please let me know and we can try to troubleshoot further.
Ryan
Ryan | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
We are having an issue with the new Cursor based pagination where we need to allow users to search for products to allow filtering. They could search for a word e.g 'blue' and all products with blue would appear. Now they have to search exact match product title strings.
Are we missing something?
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023