Searching Contacts 

Groundhogg provides search functionality using which you can search contacts by proving various arguments.

You can search contacts by passing contact_id, email, first_name, last_name, optin_status, owner, user_id  in the URL .[public_key]&token=[token]&user_id=1

You can also generate an advanced query by passing a JSON array as an argument in the HTTP request body, You need to use query attribute to perform this operation and you can add following params to your query.

number The number of contacts you wish to retrieve.-1
offset You can set offset the results using this argument. Default is 0.0
orderby The field you want to use to order the contacts.ID
includeAny specific IDs which you want to includenull
excludeAny IDs you wish to excludenull
users_include Include contacts with the associated USER IDsnull
users_exclude Exclude contacts with the associated USER IDsnull
tags_include Include contacts with the associated tagsnull
tags_exclude Exclude contacts with the associated tagsnull
optin_status Select contacts with the provided optin status. Accepts 0-6 or an array of optin stati.null
owner Include contacts with the given owner IDnull
email Select contacts with the given email address. (Will only ever return a single contact)null
first_nameSelect contacts with the given first_namenull
last_nameSelect contacts with the given last namenull
search A search string which can search all the columns provided by the below param.
search_columnsAn array of columns to search.All
meta_key Include contacts which has the following meta key, requires meta_value.
meta_valueInclude contacts with the given meta value. requires meta_key

For example:

    "query": {
        "meta_key" : "country",
        "meta_value" : "CA",
        "first_name" : "John"

The above query will search all the contacts and return a list of contacts who’s first name is John and lives in Canada. 

Was this article helpful to you? Yes No

How can we help?