# Does query task api supports orderby and OR operator clause

**URL:** <https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289>\
**Category:** Uncategorized\
**Created:** [January 22, 2019, 10:42am UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289 "2019-01-22T10:42:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramling\_h](https://avatars.discourse-cdn.com/v4/letter/r/5f9b8f/32.png) [@ramling\_h](https://forum.flowable.org/u/ramling_h)\
**Post date:** [January 22, 2019, 10:42am UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289/1 "2019-01-22T10:42:25Z")

</div>

I am trying to call “[http://localhost:8080/flowable-rest/service/query/tasks](http://localhost:8080/flowable-rest/service/query/tasks)” API to fetch cases and I want cases in a specific order. in flowable rest api is it possible to get tasks in a specific order. Also does flowable supports OR operator in query task api.

---

<div class="post-metadata">

**Author:** ![Robinyo](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Robinyo](https://forum.flowable.org/u/Robinyo)\
**Post date:** [January 22, 2019, 8:43pm UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289/2 "2019-01-22T20:43:17Z")

</div>

See:

- [General Flowable REST principles](https://www.flowable.org/docs/userguide/index.html#_general_flowable_rest_principles)
- [Paging and sorting](https://www.flowable.org/docs/userguide/index.html#restPagingAndSort)
- [List of tasks](https://www.flowable.org/docs/userguide/index.html#restTasksGet)

> [@ramling\_h](#):
>
> in flowable rest api is it possible to get tasks in a specific order.

Yes, for example:

```auto
  public getTasks(): Observable<any> {

    const endpoint = `${this.processEngineUriPrefix}runtime/tasks`;

    const sort = 'createTime';
    const order = 'desc';

    const params = new HttpParams().set('sort', sort).set('order', order);

    return this.httpClient.get<TaskListModel>(endpoint, this.getHttpOptions(params))
      .pipe(
        tap(() => {
          this.logger.info('TasksService: getTasks() completed');
        }),
        catchError(this.handleError('getTasks', []))
      );

  }

```

Also see: [Upcomig task for a user](https://forum.flowable.org/t/upcomig-task-for-a-user/3287/2)

---

<div class="post-metadata">

**Author:** ![ramling\_h](https://avatars.discourse-cdn.com/v4/letter/r/5f9b8f/32.png) [@ramling\_h](https://forum.flowable.org/u/ramling_h)\
**Post date:** [January 24, 2019, 12:00pm UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289/3 "2019-01-24T12:00:25Z")

</div>

Hi Ronbiyo,

Thanks for your reply.

Below is the sample rest call which we are making  
[http://localhost:8080/flowable-rest/service/query/tasks](http://localhost:8080/flowable-rest/service/query/tasks)  
{“includeProcessVariables”:true,  
“order”:“asc”,  
“processInstanceVariables”:[  
{

“name”:“StudentName”,  
“operation”:“like”,  
“value”:“John%”  
},  
{

“name”:“StudentName”,  
“operation”:“like”,  
“value”:“Tru%”  
}  
],  
“size”:“100”}

we are not making "this.processEngineUriPrefix}runtime/tasks’ call.

My requirement is like I want all the records where Student name is either starts with John or Trump.

Could you please help me with this

---

<div class="post-metadata">

**Author:** ![Robinyo](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Robinyo](https://forum.flowable.org/u/Robinyo)\
**Post date:** [January 24, 2019, 8:51pm UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289/4 "2019-01-24T20:51:37Z")

</div>

See: [Query for tasks](https://flowable.org/docs/userguide/index.html#_query_for_tasks)

For example:

```auto
curl -H "Content-Type: application/json" -X POST http://admin:test@localhost:8080/flowable-task/process-api/query/tasks -d "@data-6.json"

```

data-6.json:

```auto
{
  "name": "Fill in a Leave Application Form"
}

```

Response 200 OK:

```auto
{
    "data": [
        {
            "id": "0a1c8119-1cfb-11e9-b854-0242ac110002",
            "url": "http://localhost:8080/flowable-task/process-api/runtime/tasks/0a1c8119-1cfb-11e9-b854-0242ac110002",
            "owner": null,
            "assignee": "admin",
            "delegationState": null,
            "name": "Fill in a Leave Application Form",
            "description": null,
            "createTime": "2019-01-20T21:33:34.317Z",
            "dueDate": null,
            "priority": 50,
            "suspended": false,
            "claimTime": null,
            "taskDefinitionKey": "sid-3BA1F4D1-500F-4766-89BF-519166929F2D",
            "scopeDefinitionId": null,
            "scopeId": null,
            "scopeType": null,
            "tenantId": "",
            "category": null,
            "formKey": "leave-application-form",
            "parentTaskId": null,
            "parentTaskUrl": null,
            "executionId": "0a146ac5-1cfb-11e9-b854-0242ac110002",
            "executionUrl": "http://localhost:8080/flowable-task/process-api/runtime/executions/0a146ac5-1cfb-11e9-b854-0242ac110002",
            "processInstanceId": "0a135952-1cfb-11e9-b854-0242ac110002",
            "processInstanceUrl": "http://localhost:8080/flowable-task/process-api/runtime/process-instances/0a135952-1cfb-11e9-b854-0242ac110002",
            "processDefinitionId": "leave-application-process:1:003800be-1cfb-11e9-b854-0242ac110002",
            "processDefinitionUrl": "http://localhost:8080/flowable-task/process-api/repository/process-definitions/leave-application-process:1:003800be-1cfb-11e9-b854-0242ac110002",
            "variables": []
        }
    ],
    "total": 1,
    "start": 0,
    "sort": "id",
    "order": "asc",
    "size": 1
}

```

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [February 14, 2019, 2:47pm UTC](https://forum.flowable.org/t/does-query-task-api-supports-orderby-and-or-operator-clause/3289/5 "2019-02-14T14:47:53Z")

</div>

Hey @ramling_h,

Currently you can’t do OR queries over REST.

Cheers,  
Filip
