I am building a form for customers to fill in with custom fields. I was testing it for ages and they were not being created with the new contact in keap and I finally found out from the chat that the fields have to be first created within keap. So that’s ok although annoying. So I was led to understand that to send the values I need to state the id of the custom field but there seems to be no indication anywhere of what the id number is. I also read in the documentation that custom field names need to be prefixed by an underscore so does that mean the ID needs to be the field name plus underscore? Please can someone give me definitive method of sending this stuff? Many thanks
Hi Andy, the question here is are you using REST (I guess it is this one) or XML-RPC to communicate with the API?
For REST, you can use this API call to retrieve the Contact Custom Fields to see the Id numbers.
And example of sending custom fields is given in this discussion here:
For XML-RPC, you would have to prefix the custom field name with the underscore, but there is no Id Number.
Thanks Pav this is useful but I can’t work out how to turn the API call you linked to into actual PHP code to retrieve the ID numbers. I am using REST. Would you be able to help me with that please? This is the closest I’ve got which lists all contacts but no custom fields for any of them:
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
‘clientId’ => $apikey,
‘clientSecret’ => $secret,
‘redirectUri’ => $redirecturl,
//once token is set it is stored in a session and then:
$contact = $infusionsoft->contacts()->get(‘custom_fields’);
The SDK is behind with things, as I see it does not have all the functions mapped to the API methods.
I see that it runs in a mixture of REST and XML-RPC calls. It uses REST for some methods, defaults to XML-RPC for others.
So you need to use the “DataService - Query” method on the “DataFormField” table to return the Custom Fields. The code (untested) below should list all the Contact Custom Fields. From there you can get the “Id” number.
$custom_fields = $infusionsoft->data()->query('DataFormField', 1000, 0, [ 'FormId' => -1 ], [ 'Id', 'Name', 'Label' ], 'Id', true);