airesvsg / acf-to-rest-api

Exposes Advanced Custom Fields Endpoints in the WordPress REST API
https://wordpress.org/plugins/acf-to-rest-api/
1.32k stars 111 forks source link

Problem updating ACF relationship fields #403

Open wiknoro opened 2 years ago

wiknoro commented 2 years ago

I'm using the ACF relationship fields for the board's posts, however I'm struggling to update the array data. I'm sending a POST request with the modified posts' array which actually reaches the correct field but it updates data to 0. Any help would be appreciated.

    const res = await axios({
        method: "POST",
        url: `${process.env.URL}/wp-json/acf/v3/boards/${boardId}`,
        data: {
          fields:{
            posts:`${posts}`
          }
        },
        headers: {
          Authorization: `Bearer ${token}`,
          "Content-Type": "application/json"
        },
      });