How to search for product categories
8 Jun 2022Here is a little helper article for new users of our API:
One of the most used features in our API is the product search by keyword or product name.
If you would do a product search for "iPhone", you would get tons of products from all kinds of categories, ranging from iPhones themselves to all accessories that have iPhone in their name, such as covers, adapters etc. But what if you only want products from a certain category ?
Suppose you need a list of books on the iPhone X. If you look at the list of categories in appendix C in the manual, you find that books have category code 15. Now you can do a category search for iPhone X books:
https://api.ean-search.org/api?token=abcdef&op=category-search&category=15&name=iPhone%20X
And boom, you get a list with books on the iPhone X. Done.
Hint:
Keep in mind to encode spaces and other special characters in your keywords! Here you see %20 for the space between iPhone and X. And of course you need to use your own API token.
Bonus:
If you happen to use the GraphQL version of the API, you don't need to use a special search function. You can simply submit a query
{ productSearch(keywords:"iPhone X", category:15) { ean name } }