Filtering Blogs with Multiple Filters - Ghost Content API

Hi all,

I just wanted to ask if it is possible to filter blogs via the Ghost Content API with multiple tags. For instance I want to filter blogs in a continent (i.e. europe) AND a certain country (i.e. spain). How can I do this?

The API works well with OR operator (i.e. &filter=tag:[europe,spain]) but returns “Error parsing filter” when trying the AND operator (i.e. &filter=tag:[europe+spain]).

I have seen other related posts which I will leave below but I still do not understand if a solution has been found or not.

Thanks in advance!

1 Like

As suggested in the referred post, try to encode the filter.

tag:[europe+spain] == tag%3A%5Beurope%2Bspain%5D

&filter=tag%3A%5Beurope%2Bspain%5D

Yes, I tried that but it didn’t work (see below). It returns “Error parsing filter”. However, the econding version for the OR operator does work. Any other alternatives?

&filter=tag%3A%5Beurope%2Bspain%5D ( tag:[europe+spain] encoded):

&filter=tag%3A%5Beurope%2Cspain%5D ( tag:[europe,spain] encoded):

Try tags:europe+tags:spain

&filter=tags%3Aeurope%2Btags%3Aspain

1 Like

That worked, thanks a lot!