The “where” parameter for GraphQL queries opens up a whole new word of possibilities for filtering. This is a huge improvement to how filtering works with the GraphQL API.
Filters
Logic Operators
# AND, OR, NOT
{
"where": {
"OR": [
{
"title": {
"match": "engineer"
}
},
{
"NOT": {
"hotJob": {
"eq": true
}
}
}
]
}
}
Comparison Operators
# eq, in, gt, gte, lt, lte, match, regexp
{
"where": {
"book_image": {
"filename": {
"match": "my-file"
}
},
"post_image": {
"regexp": ".*.png"
}
}
}
Dates
# yyyy-mm-dd - ISO 8601
{
"where": {
"title": {
"in": ["Front-End Developer", "Engineering Manager"]
},
"_createdAt": {
"gte": "now-1w"
}
}
}
Relationships and Workflows
# Workflow
{
"where": {
"_status": {
"gt": "draft",
"lt": "published"
}
}
}
Check out the full documentation for more information. Log in and try out the new where filtering right in the API explorer.