GET request for all Tags (admin/products/tags.json)

Highlighted
Excursionist
16 0 2

Hi,

 

When I try this URL in my browser:

 

https://USERNAME:PASSWORD@SHOP.myshopify.com/admin/products/tags.json

It gives me a nice list of all the tags in my shop.

 

I need this list, but when I try an API call with Python it says 'Not found'.

 

Getting all the tags by looping over all products in too long (+- 5 seconds), whereas this gives me everything I need instantly. 

 

How can I make this request?

 

Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 166

Hey @aviation-1000,

 

The tags aren't exposed via the REST API, but they're accessible via the GraphQL Admin API:

 

 

{
  shop{
    productTags(first: 100){
      edges{
        node
      }
    }
  }
}

 

 

0 Likes
Highlighted
Excursionist
16 0 2

This is slow and requires about 5-10 calls to get the data I need.

 

I managed to make a request with Python to the admin/products/tags.json endpoint by copying the curl request it makes in chrome and exporting it in Python code with Postman.

 

It's hacky but it works. I am wondering if it's okay for Shopify for us to do this?

0 Likes