AnsweredAssumed Answered

How can I update a blog post with PUT method?

Question asked by julianfv on May 5, 2020
Latest reply on Jun 3, 2020 by john_reynolds

Hi everyone,


I have tried to update a blog post from the JavaScript console, but I have consistently gotten the following error message:


HTTP400: BAD REQUEST - The request could not be processed by the server due to invalid syntax.


My approach was as follows:


1. Define new XMLHttpRequest object:

var a = new XMLHttpRequest();


2. Open 'PUT''PUT', ''); (Note: for confidentiality reasons, I replaced the first part of the URL with DOMAIN. POST_ID is a placeholder for the contentID of the blog post I would like to update)


3. Define body

let json = JSON.stringify({

     content: {'type': 'text/html', 'text': '<p>New content of post</p>'}

     subject: 'Some subject',

     type: 'post',

     parent: ''



4. Set RequestHeader

a.setRequestHeader('Content-Type', 'application/json');


5. Send request



I have been trying to find a solution, tested the 'DELETE' method (which worked), and would really appreciate if someone could help or at least steer me in the right direction.


All the best,