Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Rest API - Getting order Information

Rest API - Getting order Information

John_Fishing
Tourist
5 0 2

I have been trying to retrieve order information using Shopify Rest API with python, but have been unsuccessful at retrieving the information that I want.

 

have made successful connection and I can search by order id/name, but the attributes I am looking to receive are not in the dictionary that is returned, it seems limited. 

 

Some fields I want to see are Line Items with (ea) cost for each item on the order, Customer Name, Address, Phone, SKU#. The line_item attribute that is being returned is returning some 14 digit number that I have no idea what it represents and have not been able to link it to the correct item. 

 

api_session = shopify.Session(merchant,'2023-01', token)
shopify.ShopifyResource.activate_session(api_session)

z = shopify.Order.find(session = api_session, status="any", created_at_min = "2022-10-01", name = '#1192')[0].attributes
print(z)

I've double checked in the admin app_config section, and my token does have full access to every option. 

Reply 1 (1)

John_Fishing
Tourist
5 0 2

Nevermind, I was able to resolve this by manually requesting to the specific order number json.

 

response = requests.get(f"https://@merchant.myshopify.com/admin/api/2023-01/orders/ORDER_ID.json", headers=headers)