I created a unique format of content on a regular 'post' post type on a WP site. These posts are built from POST requests to the WP API. And I also want to store the JSON object that built the post content. It may seem redundant but it saves a big step downstream in the automation.
I have ACF installed with a custom field 'post-json' where I will store the JSON object as a string.
The problem is: I can create the post from a POST request, no problem. But if I include the "acf" param in the request body, I get a 400 "rest_invalid_param" on the acf param.
I also tried breaking the steps apart: creating the post first, then updating its acf param. Same issue.
I also tried changing the Content-Type header, per [this suggestion](https://support.advancedcustomfields.com/forums/topic/api-post-call-error-invalid-parameters-acf/). It doesn't return a 400 but it also doesn't update the field value inside the acf param.
I hope I'm only just doing something dumb. It really seems like it's not possible to update an acf custom field's value by API. Surely this cannot be the case.
Please help.
What I've tried / some thoughts I have:
I also tried creating a custom field through the native WP. I can see this in the JSON body returned on my request but it has 'null' value and I can't successfully update this either.
A couple thoughts are.. Maybe this is a string length issue, or I'm trying to push 'text area' data into a 'text field' so to speak. But why would that return a 400 'invalid_param' error, and not some sort of data type error?
Maybe it's a permissions issue? But the API requests user has admin rights.
Sites I've read:
- https://support.advancedcustomfields.com/forums/topic/importing-data-into-acf-fields-using-api-error-received/
- https://support.advancedcustomfields.com/forums/topic/api-post-call-error-invalid-parameters-acf/
- https://github.com/AdvancedCustomFields/acf/issues/757
- there were other sites but these are the only ones that seem to be somewhat related to the issue.
https://www.advancedcustomfields.com/resources/wp-rest-api-integration/#:~:text=Enabling%20the%20REST%20API%20for%20Your%20ACF%20Fields&text=By%20default%2C%20field%20groups%20are,click%20Show%20in%20REST%20API.