Skip to content

Search tasks

Request

🔐 Required role: API_ADMIN

📖 Data dictionary: Task

Advanced task filtering with a flexible where clause and dynamic ordering

Uses standard limit/offset pagination via pageSize and page — see Pagination. Use total.aggregate.count to detect the end.

Supports flexible filtering across any task field — including nested relations such as taskType and job — using a flexible where clause, with pagination and dynamic ordering.

Common filter examples (pass in the where field):

  • By task type ID: { "taskTypeId": { "_eq": 123 } }
  • By task type code: { "taskType": { "code": { "_eq": "PREP" } } }
  • By client: { "job": { "clientId": { "_eq": 456 } } }
  • Start date range: { "startDate": { "_gte": "2024-01-01", "_lte": "2024-12-31" } }
  • Due date range: { "dueDate": { "_gte": "2024-01-01", "_lte": "2024-12-31" } }
  • By assignee: { "assigneeStaffId": { "_eq": 789 } }
  • Combined: { "_and": [ { "taskType": { "code": { "_eq": "PREP" } } }, { "assigneeStaffId": { "_eq": 789 } } ] }
Security
(BearerAuth and CfAccessClientId and CfAccessClientSecret) or BearerAuth
Bodyapplication/jsonrequired
pageSizeinteger, [ 1 .. 1000 ]

Limit — number of records to return (not a page count).

Default:50
Example:25
pageinteger, >= 0

Offset — number of records to skip. This is not a page index. To fetch the next N rows after the first N, send pageSize: N and page: N. An offset at or beyond total.aggregate.count returns an empty result array.

Default:0
Example:0
whereobject

Flexible where clause for filtering. Supports operators such as _eq, _neq, _in, _nin, _ilike, _gte, _lte, and logical combinators _and, _or, _not. Nested relations taskType and job can be filtered inline.

Example:
{ "_and": [ { … }, { … } ] }
orderByArray of objects

Dynamic ordering specifications. Each element maps a field name to "asc" or "desc". Defaults to [{ "id": "asc" }].

Example:
[ { "dueDate": "asc" } ]
curl -i -X POST \
  https://api.sandbox.aiwyn.app/gql/v1/tasks/search \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
  -H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "pageSize": 25,
    "page": 0,
    "where": {
      "_and": [
        {
          "taskType": {
            "code": {
              "_eq": "PREP"
            }
          }
        },
        {
          "assigneeStaffId": {
            "_eq": 789
          }
        }
      ]
    },
    "orderBy": [
      {
        "dueDate": "asc"
      }
    ]
  }'

Responses

Tasks retrieved successfully

Bodyapplication/json
tasksArray of objectsrequired

List of tasks matching the filter criteria

totalobjectrequired

Aggregate count matching the filter (ignores pagination)

Response
{ "tasks": [ { … } ], "total": { "aggregate": { … } } }