Category and tags naming conventions

This is not so much a jsonapi question but more a naming convention question which i cannot find the (best practice) answer to.

How to do category and tags in urls.
In my webshop i’ve got products which live in categories and have tags assocciated with them. So how can i retrieve products with categories and tags without getting ambiguous

To get a list of products:
http://api.example.com/products

To get a list of products based on category or tags:
http://api.example.com/categories/1/products
http://api.example.com/tags/2/products

But what when you want to retrieve products in a category (or two) with a specific tag?
Than it would be more like this which is basically the same:
http://api.example.com/categories/1/products?tags=4,5,6
http://api.example.com/tags/2/products?categories=1,2,3

Then something like this would be more logical?:
http://api.example.com/products?categories=1,2,3&tags=4,5,6

Supporting both would be not an option IMO.

Hope someone can point me in the right direction,

Thanks in advance,

Peter

I don’t have much advice on what you should do (others might!), but let me just say what the JSON API spec says…

All three of the endpoints you suggest would be fine, and it’s your choice which (if any) to support; the JSON API spec doesn’t put any requirements or offer much guidance on the topic.

The only thing the JSON API spec does say is that you should use the filter query parameter to do the filtering, and that you need to avoid single word query parameters like tags, as those are reserved by JSON API for future use. So, the query parameters should look like some variation of:

http://api.example.com/products?filter[categories]=1,2,3&filter[tags]=4,5,6