Hello Sebastian, this API is covered with JUnit tests so you can check it locally or check the logs at Jenkins https://ci-builds.apache.org/job/OpenMeetings/job/openmeetings/217/consoleFull (search for `openmeetings/services/file`)
PHP code is also works :) On Thu, 7 Jan 2021 at 03:08, [email protected] <[email protected]> wrote: > yes also with jpeg. Any file type. With Postman as well as via HTML form > submit. > > Or you can also trigger it via curl: > curl --location --request POST ' > http://127.0.0.1:5080/openmeetings/services/file' \ > --header 'Accept: application/json' \ > --header 'Content-Type: application/json' \ > --form 'sid="asdasdasd"' \ > --form 'stream=@"/Users/Sebastian.wagner/Pictures/my.jpeg"' \ > --form 'file=@"/Users/Sebastian.wagner/Documents/my.json"' > > Results: > WARN 01-07 09:02:03.118 o.a.c.j.i.WebApplicationExceptionMapper:73 > [p1966418217-143] - javax.ws.rs.ClientErrorException: HTTP 415 Unsupported > Media Type > at > > org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:117) > at > > org.apache.cxf.jaxrs.utils.ExceptionUtils.toHttpException(ExceptionUtils.java:168) > at > org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:516) > at > > org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:181) > > Removing the headers has no effect. Same exception. Digging through the > exception stack > => JAXRSUtils.java:516 => It just can't find a method that matches the > method signature based on the MediaType. It can match the path. > > But it can't match the arguments for the "stream" argument: type = > MediaType.APPLICATION_OCTET_STREAM > > It is NOT this type. So the method won't match and jax-rs responses. You > can set a breakpoint into the code and you will see that the payload has a > different type. > > "file" is fine. It can parse and match the json MediaType. But not > octet_stream. > > Thanks > Seb > > Sebastian Wagner > Director Arrakeen Solutions > http://arrakeen-solutions.co.nz/ > < > https://www.youracclaim.com/badges/da4e8828-743d-4968-af6f-49033f10d60a/public_url > > > < > https://www.youracclaim.com/badges/b7e709c6-aa87-4b02-9faf-099038475e36/public_url > > > > > On Thu, 7 Jan 2021 at 00:29, Daniel Baker <[email protected]> > wrote: > > > Same result with JPEG ? > > > > On 06-Jan-21 5:32 AM, [email protected] wrote: > > > I'm trying to upload a file using the Rest API > > > > > > The result is always 415 Unsupported Media Type > > > > > > The arguments and path elements match. But somehow the Media Type of > the > > > INputStream/File doesn't match application/octet_stream > > > > > > It is the same result via trying to upload from a HTML form as it is > from > > > Postman. > > > > > > Has anybody successfully uploaded a file using the Webservice ? > > > > > > Thanks > > > Seb > > > > > > Sebastian Wagner > > > Director Arrakeen Solutions > > > http://arrakeen-solutions.co.nz/ > > > < > > > https://www.youracclaim.com/badges/da4e8828-743d-4968-af6f-49033f10d60a/public_url > > > > > > < > > > https://www.youracclaim.com/badges/b7e709c6-aa87-4b02-9faf-099038475e36/public_url > > > > > > > > > -- Best regards, Maxim
