Discussing APIs and development related to customers, discounts, and order management.
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).
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
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.