Development discussions around Shopify APIs
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 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