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

aviation-1000
Excursionist
16 0 3

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
SBD_
Shopify Staff
Shopify Staff
1090 147 199

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
      }
    }
  }
}

 

 

aviation-1000
Excursionist
16 0 3

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?

yahya92
New Member
2 0 0

@aviation-1000  does tags.json contain all the tags? say I have 5K tags, will I be able to get them all using tags.json?

0 Likes