A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello everyone!
I'm using this python code to get all orders from my shop, but I'm only getting the Open orders, and I want all the orders I have completed. Does anyone know what I'm missing?
HERE THE PYTHON CODE
def get_all_orders():
secret = XXXX
api = XXXX
password = XXXX
hostname = XXXXX
version = '2021-10'
resource = 'orders'
last=0
orders=pd.DataFrame()
while True:
url = f"https://{api}:{password}@{hostname}/admin/api/{version}/{resource}/.json?limit=250&since_id={last}"
response = requests.request("GET", url)
df=pd.DataFrame(response.json()['orders'])
orders=pd.concat([orders,df])
last=df['id'].iloc[-1]
if len(df)<250:
break
return(orders)
df=get_all_orders()
HERE THE ORDERS I GET: (I want the Closed Orders)
Thank you!
Hi @VictorFerrer_95 ,
maybe your app does not have the correct permission. For all orders you need the permission read_all_orders, see https://shopify.dev/api/usage/access-scopes
Regards
Thomas
Hi @tewe ,
Thanks for your reply.
It is the Private App the app you mean? I created a Private App inside the shop and I granted to the app all the read accesses regarding orders and products:
Don't know why I'm only getting the Open orders...
Thanks!