Hello,
How can I make custom fields using infusionsoft PHP api, also How do I edit user information using php api ?
Hello,
How can I make custom fields using infusionsoft PHP api, also How do I edit user information using php api ?
Hi @kalpesh_Unknown, here’s an example of creating a contact custom field using the php sdk:
$infusionsoft->data()->addCustomField('Contact', 'Name', 'Text', $headerId);
The $headerId
variable represents which custom field header you want the field to appear under.
Unfortunately users are currently read only so you won’t be able to update user information via the API.
Hello Nicholas,
Thanks for your response. Now I want to know that if I create custom fields and want to edit those field’s value, So can I make it using php api ?
i.e in user create I have added two custom fields, password and email, so can I edit this ?
I forgot to mention that the code snippet I provided is for XML-RPC. The ability to create custom fields via REST does exist but the PHP SDK has not been updated yet. I would recommend waiting for the SDK to be updated and utilize the REST endpoint. I don’t have an exact time frame but we should be able to get it added in the next couple of weeks.
I would strongly suggest that you don’t use an Infusionsoft custom field to store a password. There isn’t any functionality to encrypt custom fields so the password will be stored and viewable in plain text.
However, if you want to store other information in a custom field, you can update a contact’s custom field by doing something like this.
$contact = $infusionsoft->contacts()->find(123);
$contact->custom_fields = [['id': 10, 'content': 'hello']];
$contact->save();
That is not valid php and it does not work.
also this code generates:
Client error: PATCH https://api.infusionsoft.com/crm/rest/v1/contacts/69?access_token=someaccessToken
resulted in a 400 Bad Request
response: {“message”:“Unrecognized property: tag_ids”}
So are you trying to update tag_ids? If so, then that is not a property available for the PATCH state based on documentation.
Solution is:
$infusionsoft->contacts()->mock(
[
‘id’ => $contactId,
“custom_fields” => [
“id” => $customFieldId,
“content” => $customFieldValue
]
]
)->save();
what is ->mock() ? Never seen that before.