Jump to content

Using the REST API to update custom fields


Go to solution Solved by Craig Gingell,

Recommended Posts

Posted

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?

 

Posted

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'
	)
);        

 

Posted

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!

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...