How this magic REST is working?

I try to get historical tasks. So I execute query:

http://localhost:8080/engine-rest/history/task?processFinished=true&processDefinitionId=someTestProcess

In result I get… nothing

This is absolutely right HTML protocol query.

Another example:
http://localhost:8080/engine-rest/history/task?&processDefinitionId=someTestProcess&finishedAfter=2021-04-13T19:38:39.043+0200

Error:
{

"type": "InvalidRequestException",

"message": "Cannot set query parameter 'finishedAfter' to value '2021-04-13T19:38:39.043 0200': Cannot convert value \"2021-04-13T19:38:39.043 0200\" to java type java.util.Date"

}

But this is exactly what u want. Date format is taken from tasklist result. It’s real.

Looks like this REST is accepting just one parameter

You probably have to URL-Encode the search value, in particular the “+” in it.

Encode is another story. But this REST simply does not work. It returns tasks ignoring ‘finishedAfter’ param. This is typical for most of Camunda REST methods - they return completely irrelevant data. For instance method should accept only GET but you sent POST and… u get result.

Hi @mkelton

I think it might be easier for you to download Camunda Platform Run and use the onboard SwaggerUi to execute the rest api, It’ll probably help you understand better where you’re going wrong. For instance if you use the swaggerUi, you’ll be able to see the details of the available parameters and even examples before being able to make the calls. e.g.

I agree with @fml2, from the description and the error, it seems that encoding is the problem.
Niall has a point too, SwaggerUI might help you, as it will take care of the encoding for you.

This is not encoding problem. Even if u encode date, REST will ignore this param and will return incorrect data.

Hi @mkelton

Our code of conduct is pretty clear

When you addressed @Yana with this…

You clearly violated.
You’re banned for a month.
Take the time to think about how you should be treating people who are trying to help you out of the goodness of their heart.

1 Like

Hi @mkelton,

maybe your request returned an empty result because the processDefinitionId didn’t match any database record?

http://localhost:8080/engine-rest/history/task?processFinished=true&processDefinitionId=TwitterQAProcess:7:e3db33be-a365-11eb-b796-4c1d96b689bb returns results for me.

I get a similar result with http://localhost:8080/engine-rest/history/task?processFinished=true&processDefinitionKey=TwitterQAProcess, it contains all versions.

See the difference between Id and Key.

Hope this helps, Ingo

1 Like