Updating a page (PUT) via REST API returns 500 Interval Server "No content to map to Object due..."
Asked by Sebastian Immoor:

Hi there,

I try to use a PUT request on a page via REST API on a Confluence 6.15.4.

The call is:
>
> ```
> wget --quiet \
> --method PUT \
> --header 'content-type: application/json' \
> --header 'authorization: Basic xsdghseuhfeshfwhefhkjf' \
> --body-data '{\n "minorEdit": "true",\n "id": "182353945",\n "type": "page",\n "status": "current",\n "title": "Sediment Echo Sounder (Parasound P70)",\n "space": {\n "id": 286982148,\n "key": "EFPW"\n },\n "body": {\n "storage": {\n "value": "<p>Test</p>",\n "representation": "storage"\n }\n },\n "version": {\n "number": 50,\n "message": "Automatically updated by Sensor2Confluence-Transporter (polarstern@binf02p165)"\n }\n}\n' \
> --output-document \
> - https://localhost/confluence/rest/api/content/182353945
> ```

The return is:

```
{
"statusCode": 500,
"message": "",
"reason": "Internal Server Error"
}
```

The log file in Confluence contains:

```
2019-08-28 10:25:20,470 ERROR [http-nio-8090-exec-63] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : 
-- url: /rest/api/content/182353945 | traceId: 253407b78f80aa52 | userName: xxxxxxx
java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2691)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490)
at com.sun.jersey.spi.container.AdaptingContainerRequest.getEntity(AdaptingContainerRequest.java:236)
at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)
at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:86)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$EntityParamInInvoker.getParams(DispatchProviderHelper.java:133)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$TypeOutInvoker._dispatch(DispatchProviderHelper.java:165)
```

Has anyone an idea? I believe it does not work since the last upgrade. But I cannot find any error in the JSON itself. A GET to that URL works fine. If I change username to a non-existing, I get an 401 Unauthorized. So everything as expected...

Cheers,

Sebastian


Answers:
author: Sebastian Immoor
body: Okay I solved the problem.

The problem was indeed a wrong URL I used.  
I used https://localhost/*confluence* /rest/api.  
Correct or new (?) is https://localhost/rest/api.

The problem is there is still some kind of redirect from /confluence/rest to /rest so a GET for example worked fine. \*But\* the redirect somehow cuts off all PUT parameters so every PUT request sent to the API was empty. Really stupid...

CURL seems to work, but WGET and my Python requests-module which was the original intention to use failed.

Sebastian


author: jira guy
body: Try curl!


Tags: confluence-server

rest-api

server