Support

Account

Home Forums Feature Requests REST API Reply To: REST API

  • Hi ,
    I m facing an annoying problem. I want to update my custom field in javascript using REST API.I have gone through all steps that you show in the documentation. Here is the code snippet:
    (Taskstatus is the custom field that I want to update)
    function updateStatus(id) {
    const payLoad = {
    Taskstatus: “In process”
    };
    const postData = JSON.stringify(payLoad);
    fetch(http://artingineer.dk/refarmedwordpress/wp-json/acf/v3/posts/${id}, {
    method: “put”,
    headers: {
    “Content-Type”: “application/json; charset=utf-8”,
    Authorization:
    “Bearer ” +
    “eyJ0eXAiOiJKV1”
    },
    body: postData
    })
    .then(res => res.json())
    .then(d => {
    console.log(d);
    });
    }