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);
});
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.