Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by tags #625

Turqueso opened this Issue Dec 21, 2017 · 4 comments


None yet
4 participants
Copy link

Turqueso commented Dec 21, 2017

I want to get my collection filtered by tags (with javascript) I had no success so far.

Some things I tried: filter: {tags: "cat1"}, filter: {tags: ["cat1"]}


This comment has been minimized.

Copy link

aheinze commented Dec 21, 2017

could you please try filter: {tags: { $all: [ "cat1" ] }}


This comment has been minimized.

Copy link

Turqueso commented Dec 22, 2017

It returns all items from the collection


This comment has been minimized.

Copy link

creativeautomaton commented Apr 4, 2018

I found the answer to this on the cockpit cms google group but the answer that fixed this for anyone in the future is this below:

http://{your website }/cockpit/api/collections/get/{yourcollectionname}?token=abd9460d02475ee1da146aff017548&filter[{your field key}]= {your value}

Replace the {} with your values it should look like this:[title]=Mulch Installation

@Turqueso @aheinze


This comment has been minimized.

Copy link

willbrowningme commented Jun 12, 2018

@Turqueso I'm using Mongolite and axios and managed to get this working with the following:`${env.cockpit.postsUrl}`, 
  filter: { tags: { $has:"the-tag" } },
  headers: { 'Content-Type': 'application/json' }

Where env.cockpit.postUrl is my cockpit posts url endpoint and "the-tag" is just the tag you want to check if the post has.

You can test that it works using postman adding a header with Content-Type of application/json and a raw body of {"filter":{"published":true, "tags":{"$has":"laravel"} }} then sending a post request with your token to your collection endpoint.

It would be great to see some examples like this in the documentation.

@aheinze aheinze closed this Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.