Tags API

Tourist
11 0 2

Is there an API that simply returns a list of unique Tags for a Shopify site? 

We are building an app and we would like to display a list of pre-existing tags used on the site. 

This seems like it would be really useful and should be made availble. Any ideas or suggestions would be greatly appreciated. 

Thanks,

Mar

 

1 Like
Highlighted
Shopify Staff
Shopify Staff
81 0 11

Hey Mar, I'll move this to the Shopify API section. You're more likely to get help there

0 Likes
New Member
7 0 0
.../products/search.json?query=tag:theTag
0 Likes
Tourist
11 0 2

Hi Jeff,

Thanks for the suggestion. However, can you please explain further? I don't understand how to apply your suggestion. To clarify, I am not trying to return the tags on a single product. Rather, I am trying to return ALL unique tags for the entire site.  

Below is some PHP code that I use to get Product information leveragin this API: https://docs.shopify.com/api/reference/product

$sc = new ShopifyClient($store_name, $access_token, SHOPIFY_API_KEY, SHOPIFY_SECRET);
$URL = "/admin/products.json"; 
$tags = $sc->call('GET', $URL, "");

 

Currently, I  loop through the entire product catalog and create an array that holds the unique Tags for the site. However, if a shop owner has 5,000+ products then it becomes really slow. What I am hoping exists, is an API call that says: Get all unique tags for the site. 

Is it possible? 

 

 

 

 

 

 

0 Likes
New Member
2 0 0

If that ever did work, it is now broken or the functionality must have been removed.

0 Likes
Shopify Expert
3944 16 330

You could try the collection approach. Since a collection.tags returns all the tags of all the products in the collection, you'd benefit. 

The comment about it being SLOW when you have 5000+ products is ridiculous. 5000 products is 20 API calls, and a small batch like that can happen in mere seconds. Who has sympathy for someone calling a few seconds too slow for an algorithm that quite frankly is not even real-time, but can happen once, slowly, and whenever? Once you iterate all products, you have all tags. Done. 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Tourist
3 0 2

i used this way to get all product tags  /admin/products/tags.json

this way /products/search.json?query=tag:theTag it return all products with specific tag

2 Likes
Shopify Expert
3944 16 330

That's cool. Undocumented feature, but cool nonetheless!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Shopify Partner
7 1 0

This (/admin/products/tags.json) would be really helpful. However, it's returning "Not Found". How do you access this endpoint through API call? I have product permissions. is there a cerain permission to be turned on? Thanks a lot!

0 Likes
Shopify Expert
9807 92 1560

Endpoints that may exist the Admin will differ to what's in the REST API. As such, there is no public tags API. Trying to scrape that info from the Admin endpoint would not be a good idea.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes