What's your biggest current challenge? Have your say in Community Polls along the right column.
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 Admin API Issue with GET Orders

REST Admin API Issue with GET Orders

himank
Shopify Partner
1 0 0

I am trying to connect an app Chatfuel with Shopify via JSON API request. My goal is to get order information about a specific order. Here is my GET URL (have removed the store name to post here).

 

https://NAMEREMOVED.myshopify.com/admin/api/2023-07/orders/#20597.json?field=id%2Cline_items%2Cname%...

 

The issue is that instead of JSON objects, it is responding back with HTML and thus I am not able to set up attribute mapping to further get values from the response and be able to show it to the users.

 

Here is what I am receiving as response:

 

html
<body>
<noscript>
<a href="https://accounts.shopify.comCONTENTREMOVEDFORCOMMUNITYPOSTux=shop">Continue</a>
</noscript>

<script type="text/javascript" defer>
window.location = "https:\/\/accounts.shopify.com\/oauthCONTENTREMOVEDFORCOMMUNITYPOST=shop";
</script>
</body>
html

 

Reply 1 (1)

chetancrao
Shopify Partner
42 5 5

Hi @himank,

 

Thank you for reaching out to the Shopify community.

 

Upon reviewing your query, it appears that you are attempting to retrieve a specific order from Shopify using the REST API. However, based on my observations of the API you provided, it seems to be incorrect. Allow me to guide you on the correct method to fetch an order, as explained below.

 

Before proceeding, please ensure that you possess the necessary access rights to the Shopify store, along with the access token or custom app credentials required to access the order resource.

 

Once you have verified that you have met the essential usage prerequisites, kindly initiate an API call using a GET request to the following URL: https://your-shopify-store-url/admin/api/2023-07/orders/{order_id}.json.

As an illustration: https://cheetosr.myshopify.com/admin/api/2023-07/orders/5235925541111.json

 

If you possess an access token obtained from a public app, please include it in the header using the following format: X-Shopify-Access-Token: shhpat_xxxxxxxxxx. On the other hand, if you have the app key and app secret obtained from a custom app, you can pass it in a basic authentication method or include it in the URL during the request.

For example https://app_key:app_secret@your-shopify-store-url/admin/api/2023-07/orders/{order_id}.json.

As an illustration: https://asdedfggegege:SFhshfhb@cheetosr.myshopify.com/admin/api/2023-07/orders/5235925541111.json

 

By following these steps diligently, you should be able to retrieve the desired order using the Shopify REST API.

 

If you require any further assistance or have additional questions, please feel free to ask.

 

Thanks.

Cheetos || Recurpay Subscriptions

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution