Development discussions around Shopify APIs
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
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...
User | RANK |
---|---|
5 | |
5 | |
5 | |
4 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022