How to get access token for curl to call REST APIs?

loganecolss
Excursionist
11 0 4

Hi everyone, I'm a Shopify app dev beginner, struggling to figure out how to make call REST APIs with curl.

IMHO, the shopify API docs are far from easy to understand, after reading again and again, I failed, please help!!

 

What I want to do is just to make a call like this:

 

curl -X GET \ https://{shop}.myshopify.com/admin/api/2021-07/shop.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {password}'

 

 

As said in the doc here: https://shopify.dev/api/admin-rest#authentication

`X-Shopify-Access-Token` is the access token, and Public and custom apps generate tokens using OAuth.

But I totally got lost in the OAuth doc page, could anyone show me an simple example how to get the token for this curl call?

 

Replies 2 (2)
loganecolss
Excursionist
11 0 4

So far I figured out how to get the access token in a very stupid way, in case this would help someone.

I created an app via `shopify node create`, and this would help to create some starter code for Shopify app dev.

In this starter code, there is some js code handling auth already (in server/server.js file), and I just put a `console.log` to print out the `accessToken` there.

Then I can use it to do curl REST API calls.

hongxg
Shopify Partner
1 0 0

Not your fault , shopify force we to do it in such stupid way,  they may end user friendly, but not developer friendly.