Looking up values in custom contact field with REST V2 API

I’ve seen this question answered for V1 and in xmlRpc, but I’m needing to figure this out using the new REST V2.

I can actually update my custom fields as I know their ids, but I’m not rather new to working with REST and I’m not sure what I should be doing to get a contact by a value in the custom field.

Thanks!

i think you will use two api calls, one to List Contacts and another Retrieve a Contact with contact id and filter the contact with your custom field value

Thanks for the input. I really don’t want to do that as it means moving all the data to a client app to search for the key to the one record I want.

That approach would be impossible if there were 10s of thousands of records to look through.

1 Like

yea i agree that not the best option with REST API V2 but i think its the only option right now, i suggest use REST API V1

i just test you can use query parameter ‘optional_properties’ => custom_fields in REST API V2 call and it will return the custom fields also

Getting the custom_fields can be done using the fields parameter.

What I’m trying to do is filter the query based on the value of one of the custom_fields.

We do not currently index custom field values for filtering due to system constraints.

Do you know if this ever got updated? Are custom fields indexed now?

No, Custom Fields are currently not indexed. This is not a defect, but a constraint based on how they are stored, retrieved, and the various types of data contained in them.

So if I wanted to look up a contact based on a custom field value I can’t do that?

Find ContactID for CutomFieldID4 when data equals string?

Is this not possible?

@TomScott, it is looking like that the REST V2 API is not going to be comparable to the XML-RPC API.

If I run a Custom Field search it takes a couple of seconds to return the results back via the XML-RPC. I am wondering why it is an issue to implement that functionality into REST? You can make changes to your platform to support it.

There are integrations out there that will require searching by Custom Fields, and i have also done that myself. In the future you plan to deprecate the XML-RPC API, so how are developers going to easily make that change to REST?

The only viable solution for REST would be to pull all the contact data into a local database, and run a search for the Custom Field in there. But that requires regularly pulling the data from Keap every time.

I agree Pav. It’s a little scary that the word is the XML-RPC API will be removed at some point when there aren’t any ways to do some things in REST v1 or REST v2. For example, I just did a bunch of updates from legacy code where they needed to send an email. That can only be done via the XML-RPC API. Same for searching by custom field (which I also needed to do for this same update), and also to run an Action Set. ALL of those had to be done via XML-RPC (and yes, I know I could change it to a tag or api goal instead of action set, then put the action set into a campaign triggered by the tag or api goal … but … :slight_smile: I’m just concerned that this was all done prematurely to have everyone update legacy code JUST SO THEY WILL HAVE TO DO IT AGAIN because the newer APIs are still not ready (which is the reason I never switched to the new APIs before now …)

Any update on this based on what @Pav said above? I’m looking to rebuild an application that is built using XML-RPC that performs a search to identify a contact based on one of the values of their custom fields.

i.e. I’m looking to retrieve a Keap user that has a particular serial number associated with it in a custom field without knowing anything else about that user in Keap.

This seems to be possible with the XML-RPC API which is what we were using before. Is there any timeline for when we can expect parity between the two? We’ve currently updated to the new authentication method, but hopefully before XML-RPC is sunsetted we can do these things.

Thanks,
Nathan.