cancel
Showing results for 
Search instead for 
Did you mean: 

Rest Query 415

atcevik
Champ in-the-making
Champ in-the-making
Hello there,

Been using activiti using rest services for a while, and while trying to add features related to query services to the application, which I did not send data to previously, I keep on getting http 415.

I use post while creating process-instances etc, no problem. And all my other requests work well.

Tried the process-instances and tasks, both presenting the same result as (guess from restlet)

{
    "errorMessage": "Unsupported Media Type",
    "statusCode": 415
}

my request headers :

POST /gipsy.web/service/query/process-instances HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Content-Length: 10
Cache-Control: no-cache
Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36
Content-Type: application/json
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

the form data I am sending is
{"id":201}

Any ideas  ? I am stuck here.

P.S. Running on a tomcat7, ubuntu server, if it matters.
9 REPLIES 9

pel
Champ in-the-making
Champ in-the-making
I've confirmed this behavior on the latest version of the REST WAR (v5.13) running under JDK 7 / Weblogic 10.3.6 with the payload submitted by Firefox/RESTClient.

My POST URL is http://hostSmiley Tongueort/activiti-rest/service/query/process-instances
and I have "Content-Type: application/json" and "Accept: application/json" defined as headers (with Authorization, of course), and the following payload:

{ "size" : 5 }

And the response is:

    Status Code: 415 Unsupported Media Type

{"errorMessage":"Unsupported Media Type","statusCode":415}

I've successfully used the Firefox/RESTClient combo to test our Activiti install on many occasions with both POST, GET, and DELETE, so I don't think the problem is with formatting or stray characters.

trademak
Star Contributor
Star Contributor
The 415 message can also be returned for other reasons. Can you look in the log of the Activiti REST application to see if there's a specific error message there?

Best regards,

tiesebarrell
Champ in-the-making
Champ in-the-making
I ran into something similar where the docs were slightly outdated. You can check the parameters you're sending by looking at the *QueryRequest class' members to see whether you have a mismatch which leads to the 415 as Tijs mentioned. For instance, if you're doing a process instance query, that would be handled by org.activiti.rest.api.runtime.process.ProcessInstanceQueryRequest . There you can see how the properties should be named in the request so you can doublecheck your input.

b_schnarr
Champ in-the-making
Champ in-the-making
Same here; I have a process with the processDefinitionId = "simpleApprovalProcess:2:2255"
I use Activiti 5.14 and the firefox RESTClient. The Query http://host-ip/activiti-rest/service/runtime/process-instances with the body

{
   "processDefinitionId":"simpleApprovalProcess:2:2255"
}

leads to

{
  "errorMessage": "Unsupported Media Type",
  "statusCode": 415
}

Other queries work well. Does anyone has an idea?

trademak
Star Contributor
Star Contributor
Do you get a stacktrace in the REST app log?

Best regards,

b_schnarr
Champ in-the-making
Champ in-the-making
Where can I find this log?

b_schnarr
Champ in-the-making
Champ in-the-making
This problem occurs with cusom processes, too. For example, when I try to add a candidate starter to a given process with the POST Method: http://10.120.40.24:8080/activiti-rest/service/repository/process-definitions/Ausgabe_beantragen:2:2...

and the body

{
   "userId":"kermit"
}

I get a 415 Unsupported Media Type error with the information: "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept"
In the header, I send Accept: application/json, Accept-Charset: utf-8, Content-Type: application/json. Other POST-Queries work fine. In this case, the log says:

<code>
Feb 12, 2014 10:57:16 AM org.restlet.engine.log.LogFilter afterHandle
Information: 2014-02-12 10:57:16 10.120.6.62 benjamin 10.120.40.24 8080 POST /activiti-rest/service/repository/process-definitions/Ausgabe_beantragen:2:2288/identitylinks - 415 - 25 16 http://10.120.40.24:8080 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 -
Feb 12, 2014 10:57:51 AM org.restlet.ext.jackson.JacksonRepresentation getObject
Warnung: Unable to parse the object with Jackson.
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "userId" (Class org.activiti.rest.service.api.engine.RestIdentityLink), not marked as ignorable
at [Source: org.restlet.engine.http.io.UnclosableInputStream@51f2e0a0; line: 2, column: 15] (through reference chain: org.activiti.rest.service.api.engine.RestIdentityLink["userId"])
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.post(ServerResource.java:1114)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:533)
at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
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:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
</code>

b_schnarr
Champ in-the-making
Champ in-the-making
ok, seems like the official REST-API documentation is wrong. With the body

{
   "user" : "kermit"
}

it works. The documentation says, that you shoul send userId.

trademak
Star Contributor
Star Contributor
Thanks, fixed the documentation in Github just now.