You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to filter out unpublished entries with the API. I've tried both:
/api/collections/{collection}/entries?filter[published:isnt]=false
/api/collections/blog/entries?filter[published]=true
Both are returning empty.
@jasonvarga said in the discord server that the API is testing the boolean true against a string true and failing.
The text was updated successfully, but these errors were encountered:
I've run into the same thing. The intuitive property to check here (as you point out, @aamood) is published, since that's returned as a top-level property for each collection entry. This property does not seem to work though. Checking the status works, though it doesn't seem to be a top-level entry property at all. The way to use it that is working for me is:
?filter[status:is]=published
And to negate it:
?filter[status:isnt]=published
or
?filter[status:not]=published
It's also worth nothing that unpublished entries are returned by default. It's unclear whether this is intended or not. If not, there should be an issue created for it (I'm happy to create it if need be).
I've submitted a pull request (#2640) which will cast true and false values in filters to booleans which will enable the filter addressed in the issue description to work correctly (ie. http://statamic.test/api/collections/pages/entries?filter[published]=true)
I am trying to filter out unpublished entries with the API. I've tried both:
/api/collections/{collection}/entries?filter[published:isnt]=false
/api/collections/blog/entries?filter[published]=true
Both are returning empty.
@jasonvarga said in the discord server that the API is testing the boolean true against a string true and failing.
The text was updated successfully, but these errors were encountered: