cancel
Showing results for 
Search instead for 
Did you mean: 

Task query REST method not allowed error - bug?

augustus
Champ in-the-making
Champ in-the-making
It could be I'm missing something, but can't find what. I'm trying to query tasks via REST but I'm getting the following error:
{"errorMessage":"Method Not Allowed","statusCode":405}


The uri I'm using is: host/service/repository/tasks?sort=id&start=1&size=5&order=asc
The JSON request object looks like this:

taskSearch: {"assignee":null,"createTime":null,"delegationState":null,"description":null,"dueDate":null,"execution":null,"id":null,"name":null,"owner":null,"parentTask":null,"priority":null,"processDefinition":null,"processInstance":null,"taskDefinitionKey":null,"url":null,"variables":null,"nameLike":"iv","unassigned":null,"candidateUser":null,"candidateGroup":null,"involvedUser":null,"taskDefinitionKeyLike":null,"processInstanceId":null,"processInstanceBusinessKey":null,"createdBefore":null,"createdAfter":null,"dueBefore":null,"dueAfter":null,"excludeSubTasks":null,"active":null,"includeTaskLocalVariables":null,"includeProcessVariables":null}


and I'm using POST method as indicated in the userguide (saw that in code as well).

Can anyone tell me if I missed something or there is some kind of bug in the task query rest service?

Thanks,
Ivan
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
That's an error in the docs, thanks for spotting that. Use the POST query/tasks instead with the JSON-body, like the query/executions and query/process-instances.

Extract from org.activiti.rest.application.RestServicesInit class, contains all paths for rest-services:
router.attach("/query/tasks", TaskQueryResource.class);
    router.attach("/query/process-instances", ProcessInstanceQueryResource.class);
    router.attach("/query/executions", ExecutionQueryResource.class);
    router.attach("/query/historic-process-instances", HistoricProcessInstanceQueryResource.class);
    router.attach("/query/historic-task-instances", HistoricTaskInstanceQueryResource.class);
    router.attach("/query/historic-activity-instances", HistoricActivityInstanceQueryResource.class);
    router.attach("/query/historic-variable-instances", HistoricVariableInstanceQueryResource.class);
    router.attach("/query/historic-detail", HistoricDetailQueryResource.class);

augustus
Champ in-the-making
Champ in-the-making
Thanks, found few more errors in the docs. I'll post them to a new post once I'm done.

frederikherema1
Star Contributor
Star Contributor
Great… You can also create them as a pull-request or patch-file Smiley Wink