Hi I am trying to get all Orders from a shopify store via shopify API, I am using an R script and so far I am only able to get 250 records that is the limit per page, if I dont use the limit keyword in the php it defaults it to 50.
Here is what I have so far
library(dplyr)
library(httr)
library(rlist)
library(jsonlite)
apikey <- "xxxxxxxxxx1d2fd1fb8710"
pass <- "xxxxxxxxxxxx3e4d38d476fdb188ac7"
orders <- GET(
url = "https://xxxxx-xxxxx.myshopify.com/admin/orders.json?query=&limit=250&status=any",
authenticate(user = apikey, password = pass)
)
If I want to do the same via PHP I use the https call and I get the same 250 results
https://1x877xxxxbd3ed99ae30d1eb4d71cxxx:[email protected]/admin/orders.json?query=&limit=250&status=any
Is there a way that I can get ALL orders in one call?
Or if not, is there a way to get different pages, like page 1,2,3,4,5 etc and later on I can union those dataframes into 1.
2
Answers
Use paging. Clearly described in the documentation.
As others have said, you have to use pagination. I recently created an R package called shopr that makes this fairly easy.
shopr will make successive calls to the API, fetching chunks of 250 orders and then combine them together for you.