It seems our documentation needs a little work in order to be more clear. Weâll work to update that. In the meantime, I hope the following helps.
Custom fields are only available for individual contacts via Retrieve a Contact, using optional_properties. List Contacts does not accept optional_properties and does not return custom fields.
For anyone else who stumbles across this thread trying to figure out how to update or retrieve custom_fields via the REST API. It took me a while to figure out but it does work and works well.
When you start digging around information in your IS instance settings looking at custom fields youâre going to come across this text link: View the field database names (for the API). The info you get in this popup I think refers only to the older XML methods, so if youâre using the REST API and JSON this isnât for you.
First off you need to find out information about your custom fields. SO assuming you have at least one custom field set up, put some test text in it that youâll recognise and head over to the developer rest API here: Keap REST API
You want to use the âContact > Retrieve a contactâ method, and in the parameters > optional properties field input âcustom_fieldsâ (I am also assuming you have a client id and secret set up in mashery so that you can try the interactive api docs - otherwise head over there and set that up first). The result displayed here will give you the IS unique id for each custom field you have set up in your instance as well as the value assigned currently.
Now you know what the id is you can format your Rest Request parameters. The correct format is as follows:
Unfortunately we do not have Custom Fields enabled on all endpoints, but itâs possible to use your same Access Token to call the XML-RPC API and get the data from the DataFormFields (internal name for Custom Fields).
Is there a way, currently, to update a contactâs âoptional_propertiesâ? I am able to retrieve a contactâs optional properties, but have not figured out a way to update them via the api.
Specifically I am looking to update âcompany_nameâ which is listed under optional_properties. It doesnât have the same structure as custom_fields so there must be a different way to update this via the api.