I am trying to use the Confluence REST API to upload an attachment and I'm getting this response:
{"statusCode":500,"message":"javax.ws.rs.WebApplicationException: null"}
I've tried to simplify the moving parts as much as possible. While this error is happening in my add-on, it is also happening if I try a simple curl request:
curl -vk -X POST http://(confluence url):1990/confluence/rest/api/content/(page id)/child/attachments -H "X-Atlassian-Token: nocheck" -H "Authorization: JWT (token)" -F file=@image.png
I've done my best to follow the
Confluence REST API Documentation in this matter; however, the documentation is inconsistent, particularly with regard to the url I should be hitting. I have also tried to POST to /confluence/rest/api/content/(page id)/attachments, and that results in an xml 404 response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://(confluence url):1990/confluence/rest/api/content/(page id)/attachments</message></status>
I am developing for Confluence 5.5-OD-23-004.
Here is a brief stack trace that gets logged during the 500 error:
2014-06-26 17:03:10,401 ERROR [http-1990-1] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error :
-- url: /confluence/rest/api/content/(page id)/child/attachments | userName: addon_(addon-key)
javax.ws.rs.WebApplicationException
at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:178)
...
What am I doing wrong?