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.

GET requests to REST API don't work with Curl or Postman, just Chrome?

GET requests to REST API don't work with Curl or Postman, just Chrome?

CRandyHill
Excursionist
17 0 5

I am very sure this is a very silly mistake on my part. I have a working app that has no problem making requests to both the GraphQL and REST APIs, and am adding some calls to the Orders API. I wanted to prototype them in Postman, but have not been able to get any request to work, every request is met with a 

"errors": "[API] Invalid API key or access token (unrecognized login or wrong password)" response.
 
 Following the instructions at https://shopify.dev/tutorials/debug-apps-with-postman-for-mac-os I am using the standard URL format: 
 
https://<API Key>:<password>@<store name>.myshopify.com/admin/api/2020-07/shop.json
 
All my requests are GET requests (shop.json, orders.json, etc) so cookies shouldn't be an issue though I've cleared them in Postman. I've also tried the basic auth approach.
 
These URLs don't work with Curl either, but the weird part is if I try the URLs in Chrome, they work perfectly and return JSON with all the orders and customer information that shop.json and orders.json are supposed to return.
 
I'm thinking my mistake is using the wrong password. I'm using my login password and that doesn't seem right, but its the only password I can find in my account (I'm owner/admin) and it works for the URLs when I use Chrome?
 
 
 
 
Replies 4 (4)

akatcha
Tourist
7 1 1

I'm having this same exact issue when following the guide online with a cURL command.  Have you found a solution to it?  

Thanks.

CRandyHill
Excursionist
17 0 5

@akatcha I'm back on this, and in Shopify just got a GET request to /admin/api/2020-07/orders/count.json working using a "X-Shopify-Access-Token" with no authorization.

CRandyHill
Excursionist
17 0 5

Of course it doesn't work from my app, but one problem at a time.

AndyPicamaze
Explorer
41 1 15

Hi

This one is working for me for my app

const productImageAdminAPI = `https://${auth.shop}/admin/api/${process.env.API_VERSION}/products/${productId}/images.json`;

return fetch(productImageAdminAPI, {
method: 'post',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': auth.accessToken,
},
}).then((res) => res.json());

For Postman I do it like: 

image.png

https://API_KEY:PASS@ ... .myshopify.com/admin/api/2020-04/products/${productId}/images.json works for private apps. 

https://apps.shopify.com/picamaze
Animated watermarks for product images and ads