Invalid API token + tried python script with same token

Invalid API token + tried python script with same token

davidsods
Visitor
2 0 0

Hi everyone! I am getting this response when I do a PUT request to this URL: "url":"https://shop_name.myshopify.com/admin/api/2023-10/orders/{order.id}.json

I am trying to add an order tag. 

I get this response.

{"status":401,"response_body":"{\"errors\":\"[API] Invalid API key or access token (unrecognized login or wrong password)\"}", 

I ran a python script with the same exact Admin API access token and it worked, same URL, same everything. I just wanted to get this to work as an automation and it does not work in the shopify admin workflows. 

I am using this key 'X-Shopify-Access-Token'


Does anyone have any ideas?

Replies 3 (3)

davidsods
Visitor
2 0 0

Any help??? I would love anything from anyone

paul_n
Shopify Staff
1563 170 359

You need to use legacyResourceId not id in URLs. 

 

In order to output a variable, it must be enclosed in {{ }} not { }. So replace that with :

{{ order.legacyResourceId }}
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
1563 170 359

For the API key, you need to create a custom app api key that has the write scopes and use the key there. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.