Step 2: Using the Filter Parameter

The Live API’s Entities: List and Entities: GeoSearch endpoints give you the ability to filter your entities by field values. For example, you could filter out all Location entities that have the closed field set to true. The URL would be formatted as follows:

The entityTypes query parameter supports a comma-separated list of Entity Type IDs to filter on. You can find the ID for a specific entity type by navigating to Knowledge Graph > Configuration > Entity Types in your account and viewing the details for a given Entity Type. The ID is listed under the Entity Type’s Settings tab.

The filter parameter represents one or more filtering conditions that are applied to the set of entities that would otherwise be returned. This parameter should be provided as a URL-encoded string containing a JSON object. Some filters allow you to filter by multiple values. The example below returns all entities that have a firstName that is either “Timothy” or “Robert”.

{firstName: {in: [Timothy,Robert]}}

It is possible to combine as many different filters as desired, either using the combinator $and or $or. For example, the filter below returns results that have name set to either “Captain Nick’s” or “Robert’s” and have attire set to “Dressy”.

{"$and": [{"name":{"$in": ["Captain Nick's","Robert's"]}}, {"attire":{"$eq": "DRESSY"}}]}

To learn more about the Live API filter options, check out the Live API Documentation for more details and examples.

Feedback