Development discussions around Shopify APIs
I'm trying to use the newer cursor based paging. I use a url similar to:
store/admin/api/2019-07/products.json?limit=5
The headers returned with after the call to the api have:
x-shopify-shop-api-call-limit: 1/40 x-shopify-api-version: 2019-07 link: ; rel="next"
There is no 'page_info' parameter for me to use to get the next page of results. And how do I use a 'rel' attribute in an API call? Is this passed as a 'rel' header?
Be really helpful if someone could post a code segment of looping through some pages. The docs don't make a lot of sense to me since the response headers in the docs don't match the response headers from the api.
I'd think it would be something like:
$link_info=''; do { $new_data = Http:get("shop/admin/api/2019-07/products.json?limit=5".($link_info?"&page_info=$link_info":'') ); $link_header = getLinkHeader(); $link_info= $link_header; // should contain something like page_info=xyz&rel=next if( $new_data ) processNewData($new_data); } while(!empty($new_data));
Solved! Go to the solution
Shopify product searching by title is supported with exactly same product title name. Partially title searching is not supported by shopify in recent Rest Admin api version. But it is available in GraphQL api. You can use it.
@maltillo wrote:Our app is backend. We allow users to apply bulk price updates to their products. They first need to search and filter through to find the products they want to update. Before they could search 'Blue' and the search would bring up all products with 'blue' in the title. Now that doesn't work.
We are using REST API.
Thanks for your reply.
Our app is written in REST API
Does this mean re-writing the entire app in GraphQL api?
No, not at all.
You can only do the searching operation with GraphQL whereas other operation in Rest API
@maltillo wrote:Thanks for your reply.
Our app is written in REST API
Does this mean re-writing the entire app in GraphQL api?
.
The parsing method Dante provided worked for me. The links are there in the response, but they will not show up in the browser rendered view of the page if you are printing out the response.
Holly cow, spent 2 hours trying to figure this one out, had the same issue O.o
I totally agree with you and feel like throwing the same egg on the person who decided the stupid syntax of using <>'s for the cursor-pagination links.
How immature to complicate things.
First the user will have to parse the link header itself and use explode to get value of the rel parameter and then use the link finally.
I was thinking that i had the same problem,
but the truth was, how the link is between "<>" and i tried to see it in a Browser
the Browser understand that everything is between the "<>" as a HTML tag.
But in Google Chrome is possible to use CTRL + U ( or right click -> show source code ) and there will be the link.
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