I'm trying to update a landing page using the REST API.
The docs state that all fields in the request body are optional. Yet, I am getting back the following error: code=701, message=type cannot be null.
I've tried setting type explicitly to both HTML and RichText, but the error persists.
My JSON payload looks like this:
{
"type": "HTML",
"value": "[A properly escaped chunk of HTML copied from the response to a GET request for the same asset]"
}
The URL is constructed correctly, as far I can see. I set Content-Type to application/json. Not sure what else I could do to make it happy.
The documentation is incorrect, we will correct it.
Until then, two things:
1. The "type" parameter is required
2. The payload is application/x-www-form-urlencoded (not JSON)
the Documentation was not corrected (after +1year) and I still get an error when I try to do an update. As payload I use type RichText and a string value.
The payload is : "{\"type\":\"RichText\",\"value\":\"<![CDATA[<div>hello</div>]]>\"}"
The update response that is receive is "{\"success\":false,\"errors\":[{\"message\":\"type cannot be null\",\"code\":\"701\"}],\"requestId\":\"xxxx\",\"warnings\":[]}"
Can you please help out?
The payload must be sent as application/x-www-form-urlencoded (not JSON).
For example: POST /rest/asset/v1/landingPage/{id}/content/{contentId}.json?type=RichText&value=<![CDATA[<div>hello</div>]]>