title: How do I update Advanced Custom Fields on Wordpress with node-WPAPI?
body: <p>I'm using <a href="https://www.npmjs.com/package/wpapi" rel="nofollow noreferrer">node-wpapi</a> to interact with my Wordpress site.</p>
  <p>I have the <a href="https://www.advancedcustomfields.com/" rel="nofollow noreferrer">Advanced Custom Fields</a> and <a href="https://wordpress.org/plugins/acf-to-rest-api/" rel="nofollow noreferrer">ACF to REST API</a> plugins installed.</p>
  <p>I'm trying to use wpapi to update the value of the property &quot;main_sidebar&quot; for a post.  Here is currently working code that gets and logs the contents of &quot;main_sidebar&quot; for post 62542:</p>
  <pre><code>const WPAPI = require ('wpapi');
  
  
  var wpdev = new WPAPI ({
      endpoint: '..../wp-json',
      username: '...',
      password: '...'
  });
  
  wpdev.acfAPI = wpdev.registerRoute(&quot;acf/v3&quot;, &quot;/posts/(?P&lt;id&gt;[\\d]+)/?(?P&lt;field&gt;[\\w\\-\\_]+)?&quot;, {
      params: [ 'main_sidebar' ]
  });
  
  main();
  
  async function main () {
      let resp = await wpdev.acfAPI().id(62542).field(&quot;main_sidebar&quot;).get();
      console.log(resp);
      console.log(JSON.stringify(resp));
  }
  </code></pre>
  <p>I cannot figure out how to set the value of this property.  I don't understand how I'm supposed to interact with it.  I tried updating it on the actual post as well, with no luck:</p>
  <pre><code>await wpdev.posts().id(...).update({
      data: { &quot;acf&quot;: { &quot;main_sidebar&quot;: &quot;test value&quot; } }
  });
  </code></pre>
  <p>If this can't be done with wpapi for some reason I'm open to doing it some other way.  I only need to update this specific property for each post.</p>
  <p>Edit:</p>
  <p>I believe I may have been trying to update the wrong resource.  Here's what I'm trying now:</p>
  <pre><code>    let result = await wpdev.posts().id(117925).auth().update({
          data: {
              &quot;acf&quot;: {
              &quot;main_sidebar&quot;: &quot;test&quot;
              }
          },
          status: 'publish'
      });
      console.log(result);
  </code></pre>
  <p>This doesn't throw an error and &quot;result&quot; is just the post data.  It doesn't update the post.  Now I'm twice as confused.</p>