IntelliSearch (aka Smart Views)

You can get more details about Lead data structure from here. Please note, IntelliSearch and Smart Views are internally the same

Queries

List all IntelliSearches

Resource URL

GET /companies/<company_uuid>/smart_views

Parameters

Parameter Description
--- ---

Example Request

curl "https://api.metroleads.com/companies/ef09248c-67ad-4090-a57f-1557bcfb1cd8/smart_views"

Example Response

[
  {
    "name": "My Leads",
    "smart_view_id": "945f6aa1-c1fe-4686-8e2e-4583eb04f255"
  },
  {
    "name": "All",
    "smart_view_id": "2804b745-5071-4f0c-ae40-d17442d94421"
  },
  {
    "name": "Leads",
    "smart_view_id": "e775b4e5-0307-4264-ba87-d7413a34873b"
  }
]

Get an IntelliSearch

Retrieves an IntelliSearch along with leads and facets

Resource URL

GET /companies/<company_uuid>/smart_views/<smart_view_uuid>

Parameters

Parameter Description
tz_offset Timezone offset of the client in minutes. e.g. 330 which is +5:30 or IST
relative Relative time duration to search the leads in e.g. last_three_months. For a valid list of relative times see Constants
sort A valid JSON of the sort order parameters. e.g. {"last_modified_time_es":{"order":"desc"}}. For a valid list of relative times see Constants
count Number of leads to fetch e.g. 51
filters A valid JSON to add additional filters. This contains the selected facets.

Example Request

curl https://api.metroleads.com/companies/cc13154e-6ac2-4612-ab5b-cb2fdcd59821/smart_views/d4e305ec-c8f4-4ae0-9b84-0f9ff0aac684?&tz_offset=330&relative=last_three_months&sort={%22last_modified_time_es%22:{%22order%22:%22desc%22}}&count=51&filters=%7B%7D

Example Response

{
  "count": 6,
  "leads": [
    {
      "allow_unmerge": false,
      "lead_id": "bcbd18c6-e768-4762-b2ba-d6f9f7631ed2",
      "source_tags": [],
      "lead_creation_time": "2017-01-12T05:09:38Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "contacted",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "mg-test-5@example.com"
        }
      ],
      "name": "Z"
    },
    {
      "allow_unmerge": false,
      "lead_id": "d8688844-e964-44d1-a2fe-8b8af4c217e4",
      "source_tags": [],
      "lead_creation_time": "2017-01-12T05:09:06Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "open",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "mg-test-1@example.com"
        }
      ]
    },
    {
      "allow_unmerge": false,
      "lead_id": "ea9191e3-5b4b-4243-ac3b-903a9017f1c2",
      "source_tags": [],
      "lead_creation_time": "2017-01-12T05:09:32Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "open",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "mg-test-4@example.com"
        }
      ]
    },
    {
      "allow_unmerge": false,
      "lead_id": "5e804efb-e868-4d1a-8fe2-3a8c54c686cb",
      "source_tags": [],
      "lead_creation_time": "2016-09-12T08:00:02Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "open",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "arif.amirani@gmail.com"
        }
      ],
      "name": "Arif Lead Z"
    },
    {
      "allow_unmerge": false,
      "lead_id": "75200e30-8c73-455c-aa4d-b97d2ec26e7f",
      "source_tags": [],
      "lead_creation_time": "2017-01-12T05:09:26Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "open",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "mg-test-3@example.com"
        }
      ]
    },
    {
      "allow_unmerge": false,
      "lead_id": "0abf7e32-91ec-47cd-8328-9014db88ead2",
      "source_tags": [],
      "lead_creation_time": "2017-01-12T05:09:21Z",
      "lead_group": "5636140f-2ecd-44da-838f-be860d516f31",
      "location_names": [],
      "state": "open",
      "assigned_to": {
        "name": "Arif Test Admin",
        "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
      },
      "user_assigned_to": "48d58b40-a31b-445b-bc0c-c8726e2c664a",
      "emails": [
        {
          "type": "Work",
          "email": "mg-test-2@example.com"
        }
      ]
    }
  ],
  "facets": [
    {
      "display_name": "User Assigned",
      "total_available_facets": 6,
      "facet_type": "terms",
      "short_display_name": "User Assigned",
      "values": [
        {
          "count": 6,
          "selected": false,
          "display_name": "Arif Test Admin",
          "id": "48d58b40-a31b-445b-bc0c-c8726e2c664a"
        }
      ],
      "total_facet_count": 1,
      "id": "user_assigned"
    },
    {
      "display_name": "Lead State",
      "total_available_facets": 6,
      "facet_type": "terms",
      "short_display_name": "Lead State",
      "values": [
        {
          "count": 5,
          "selected": false,
          "display_name": "Open",
          "id": "open"
        },
        {
          "count": 1,
          "selected": false,
          "display_name": "Contacted",
          "id": "contacted"
        }
      ],
      "total_facet_count": 2,
      "id": "state"
    },
    {
      "display_name": "Lead Group",
      "total_available_facets": 6,
      "facet_type": "terms",
      "short_display_name": "Lead Group",
      "values": [
        {
          "count": 6,
          "selected": false,
          "display_name": "Leads",
          "id": "5636140f-2ecd-44da-838f-be860d516f31"
        }
      ],
      "total_facet_count": 1,
      "id": "lead_group"
    }
  ]
}

Search within a facet

Searches values within a facet.

Resource URL

POST /companies/<company_uuid>/smart_views/<smart_view_uuid>/aggregations

Parameters

Parameter Description
tz_offset Timezone offset of the client in minutes. e.g. 330 which is +5:30 or IST
relative Relative time duration to search the leads in e.g. last_three_months. For a valid list of relative times see Constants

JSON Body Parameters

{
  "facets": {
    "<field_name>": {
      "sort_by": "name",
      "sort_order": "asc",
      "search": "<search_query>",
      "limit": 10
    }
  },
  "filters": {},
}
Parameter Description

Example Request

curl "https://api.metroleads.com/companies/54d8b88b-3d3c-4ae0-adee-08f8640b1f49/smart_views/1a358ba5-3e5d-43eb-9258-39ab4dede31e/aggregations?tz_offset=330&relative=all_time" -d '{"facets":{"lead_field_str_customer_type":{"sort_by":"name","sort_order":"asc","search":"A","limit":10}},"filters":{}}'

Example Response

[
  {
    "display_name": "Customer Type",
    "total_available_facets": 28703,
    "facet_type": "terms",
    "short_display_name": "Customer Type",
    "values": [
      {
        "count": 243,
        "selected": false,
        "display_name": "Black Listed/Blocked",
        "id": "Black Listed/Blocked"
      },
      {
        "count": 4371,
        "selected": false,
        "display_name": "High Value",
        "id": "High Value"
      },
      {
        "count": 43,
        "selected": false,
        "display_name": "Low Value",
        "id": "Low Value"
      },
      {
        "count": 4,
        "selected": false,
        "display_name": "High Income",
        "id": "High Income"
      },
      {
        "count": 12401,
        "selected": false,
        "display_name": "Low Income",
        "id": "Low Income"
      },
      {
        "count": 121,
        "selected": false,
        "display_name": "Affluential",
        "id": "Affluential"
      },
      {
        "count": 37,
        "selected": false,
        "display_name": "Referral",
        "id": "Referral"
      },
      {
        "count": 1554,
        "selected": false,
        "display_name": "Friend",
        "id": "Friend"
      },
      {
        "count": 21,
        "selected": false,
        "display_name": "Group President",
        "id": "Group President"
      },
      {
        "count": 1,
        "selected": false,
        "display_name": "Employee",
        "id": "Employee"
      }
    ],
    "total_facet_count": 27,
    "id": "lead_field_str_customer_type"
  }
]