cancel
Showing results for 
Search instead for 
Did you mean: 

setting/updating properties of task via REST-API doesn't work

clnyx
Champ in-the-making
Champ in-the-making
Hello,

i already got a task by starting a process instance (http://www.activiti.org/userguide/index.html#N13876).
But I am missing some fields, that won't get set to the task.
I want to set the "dueDate" field for the task.

Json looks like this:
{"dueDate": null}
Url:
/activiti-rest/service/runtime/tasks/2250

When I try to update it, the server throws:

org.restlet.ext.jackson.JacksonRepresentation getObject
WARNUNG: Unable to parse the object with Jackson.
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "dueDate" (Class org.activiti.rest.api.runtime.task.TaskActionRequest), not marked as ignorable
at [Source: org.restlet.engine.http.io.UnclosableInputStream@657348b8; line: 1, column: 17] (through reference chain: org.activiti.rest.api.runtime.task.TaskActionRequest["dueDate"])
        at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53)
        at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267)
        at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673)
        at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659)
        at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365)
        at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725)
        at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:703)
        at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
        at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)
        at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1909)
        at org.restlet.ext.jackson.JacksonRepresentation.getObject(JacksonRepresentation.java:139)
        at org.restlet.ext.jackson.JacksonConverter.toObject(JacksonConverter.java:218)
        at org.restlet.service.ConverterService.toObject(ConverterService.java:161)
        at org.restlet.resource.UniformResource.toObject(UniformResource.java:647)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:434)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:493)
        at org.restlet.resource.ServerResource.post(ServerResource.java:1084)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:383)
        at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:594)
        at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
        at org.restlet.resource.ServerResource.handle(ServerResource.java:849)
        at org.restlet.resource.Finder.handle(Finder.java:513)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
        at org.restlet.Application.handle(Application.java:391)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
        at org.restlet.Component.handle(Component.java:391)
        at org.restlet.Server.handle(Server.java:491)
        at org.restlet.engine.ServerHelper.handle(ServerHelper.java:74)
        at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:153)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1031)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
23.10.2013 09:44:32 org.restlet.engine.log.LogFilter afterHandle
INFO: 2013-10-23        09:44:32        192.168.133.28  kermit  192.168.133.33  8080    POST    /activiti-rest/service/runtime/tasks/2250       -       415     -       17      27       http://192.168.133.33:8080      Apache-HttpClient/4.2.6 (java 1.5)      -


But I am able to close the task using the same url but the json: {"action": "complete"}
After looking into the docuemntation (http://www.activiti.org/userguide/index.html#N14412) I thought that would be the right way to set a "dueDate" and/or other field-Values.

Am I missing something?

Thank you for any input.

3 REPLIES 3

trademak
Star Contributor
Star Contributor
You should use a PUT instead of a POST.

Best regards,

clnyx
Champ in-the-making
Champ in-the-making
Thank you, that worked.

I have just a simple process, containing one task. Can I create the process instance, that the task automatically gets the "dueDate"-Field filled? Or do I have to update the task afterwards?

Greetings, syccl

trademak
Star Contributor
Star Contributor
Sure you can, it's explained in the user guide in the user task description.

Best regards,