Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Craig Gingell Posted April 5, 2021 Posted April 5, 2021 Hello, I have read the REST API documentation here: https://invisioncommunity.com/developers/rest-api?endpoint=core/members/POSTitem I am trying to update a custom field value, but cannot fathom the syntax for the customFields value. The docs state: customFields  object  Array of custom fields as fieldId => fieldValue but can someone please provide an example? Let's say I have a custom field number 10, and I want to set it's value to "XYZ123" what should I be posting in the customFields value? I tried [{'fieldId':'10','fieldValue':'XYZ123'}] but the field value didn't update. Any ideas? Â
Daniel F Posted April 5, 2021 Posted April 5, 2021 it's an array with the id as key and value as value, not fieldID => X , fieldvalue=> Y 😉 $data = array( 'customFields' => array( 1 => 'FOO', 2 => 'BAR', 10 => 'BAZINGA' ) ); Â
Craig Gingell Posted April 5, 2021 Author Posted April 5, 2021 Thank you Daniel for your help. I should have said, I am working in Javascript and attempting to submit this as an HTML <form> Have you got a sample that will work with Javascript? Cheers!
Solution Craig Gingell Posted April 5, 2021 Author Solution Posted April 5, 2021 Ok, after a bit more trial and error testing, I worked it out:  Quote  <input name="customFields[10]" value="XYZ123"> Â
Recommended Posts