I can’t seem to find a way or any reference to searching on custom fields from the API. When I do, it seems to ignore it and return all records. I did use the name of the custom field for the API that IS gives you and added the preceding underscore, but no luck. It seems like this should be possible, am I missing something or is it actually not possible?
The question is how are you doing the search? Can you share your code example?
As you said you should be able to do this: “_CustomField” => “ABC”.
Old iSDK example: $infusionsoft->dsQuery(‘Contact’, 1000, 0, array(‘_Term’ => 456), array(‘Id’, ‘FirstName’));
The Custom Field Name needs to match exactly the one stored in Infusionsoft.
Thanks for the reply.
So I’m using Python, and using Requests to do the query:
This works exactly as expected:
IS = requests.get(
"https://api.infusionsoft.com/crm/rest/v1/contacts",
params={'family_name': 'bond', 'access_token' : IS_token}
)
So I know the token and everything else is right. The problem is with this:
IS = requests.get(
"https://api.infusionsoft.com/crm/rest/v1/contacts",
params={'_OrderNumber1': '57148', 'access_token' : IS_token}
)
It returns all records.
If I query https://api.infusionsoft.com/crm/rest/v1/contacts/model it does list the custom fields, but only the keys. I notice these are all under the JSON subarray of custom_fields. I’m starting to think I’m asking the wrong question, as I know that ‘email’ is also under the subarray email_addresses, and I can’t figure out how to query on that field either. Any insight on how I would access those?
Thanks
Not sure if you’re using REST what it would be but I believe the SDK includes a query by field.
I personally stay away from using REST because it is incomplete.
Looking at the REST documentation it is very limited to what it can search on:
https://developer.infusionsoft.com/docs/rest/#!/Contact/listContactsUsingGET
You will have to go through the XML-RPC route to query by the Custom Field.
This is the API function you would need, and the table is “Contact”.
https://developer.infusionsoft.com/docs/xml-rpc/#data-query-a-data-table
There is a Python example there, so your Query Parameters would work.
Thanks for the tips. This was my first attempt and I had no idea there was an SDK, so I’m gonna give that a go, as it seems much cleaner. Cheers
Has there been any further attempts to add support for this via the ReST API calls? I’d love to be able to make a ReST call for a contact via a custom field.
Seems like I may have received my answer from this other question here:
tl;dr Due to system constraints, filtering contact list by a custom field isn’t possible with the ReST API calls.