Search Saved Locations

Search for an existing Saved Location.

Request

HTTP Request

GET https://api.predicthq.com/v1/saved-locations

Query Parameters

FieldDescription

location_id string

A comma-separated string consisting of a list of 1 or more location_id's.

E.g. ?location_id=6TxvEapQeDzq9y_UKVRQCQ

q string

A full-text search query that searches across the following fields:

  • name

  • description

  • location_code

  • formatted_address

  • labels

E.g. q=alabama

sort string

A comma-separated list of fields to sort results by. Use the - prefix to sort descending.

Possible values:

  • name - Sort by name A-Z

  • -name - Sort by name Z-A

  • created - Sort by created date oldest to newest

  • -created - Sort by created date newest to oldest

  • updated - Sort by updated date earliest to latest

  • -updated - Sort by updated date latest to earliest

  • address - Sort by address A-Z

  • -address - Sort by address Z-A

You can also sort by the summary insight values. Summary insights are calculated for different date ranges (currently only the next 90 days have been implemented) and you need to choose which date range to sort by.

Use the format below to sort by summary insights:

<date_range_type>.<summary_insight_key>

For example, below are the sort options for the summary insights calculated for the next 90d:

  • next_90d.phq_attendance_sum

  • next_90d.attended_event_count

  • next_90d.non_attended_event_count

  • next_90d.unscheduled_event_count

  • next_90d.pes_accommodation_sum

  • next_90d.pes_hospitality_sum

  • next_90d.pes_total_sum

  • next_90d.pes_transportation_sum

You can prefix these with a minus sign - to reverse the order.

E.g.: ?sort=-created

limit string

The maximum number of results to return. The default limit is 10.

E.g. ?limit=50

offset string

Used for paging. The number of results to skip. The default is 0.

E.g. ?offset=20

Response

Response Fields

FieldDescription

count number

Total number of results found.

locations array

List of results where each item is a Saved Location.

Please refer to the response fields section in Get a Saved Location for the structure of each record.

Example response

Below is an example response:

{
  "count": 1,
  "locations": [
    {
      "location_id": "h8LbiiiTOXsxSAI0p3wEIg",
      "create_dt": "2023-03-27T22:07:00+00:00",
      "update_dt": "2023-07-03T04:31:38+00:00",
      "enrich_dt": "2023-07-03T04:31:39+00:00",
      "insights_dt": "2023-07-03T04:31:40+00:00",
      "name": "My Parking Building",
      "labels": [
          "parking"
      ],
      "geojson": {
          "type": "Feature",
          "properties": {
              "radius": 0.9,
              "radius_unit": "mi"
          },
          "geometry": {
              "type": "Point",
              "coordinates": [
                  -122.40152,
                  37.7869
              ]
          }
      },
      "formatted_address": "666 Mission St, San Francisco, CA 94105, USA",
      "places": [
          {
              "place_id": 5391959,
              "type": "locality",
              "name": "San Francisco",
              "county": "City and County of San Francisco",
              "region": "California",
              "country": "US",
              "geojson": {
                  "type": "Feature",
                  "geometry": {
                      "type": "Point",
                      "coordinates": [
                          -122.41942,
                          37.77493
                      ]
                  }
              }
          }
      ],
      "summary_insights": [
          {
              "date_range": {
                  "type": "next_90d",
                  "start_dt": "2023-07-03T04:31:40+00:00",
                  "end_dt": "2023-10-01T04:31:40+00:00"
              },
              "phq_attendance_sum": 2646606,
              "attended_event_count": 519,
              "non_attended_event_count": 85,
              "unscheduled_event_count": 0
          }
      ],
      "subscription_valid_types": [
          "events"
      ],
      "status": "active"
    }
  ]
}

Examples

curl --location 'https://api.predicthq.com/v1/saved-locations?q=alabama&limit=50' \
--header 'Authorization: Bearer TOKEN'

Guides

Below are some guides relevant to this API:

Last updated

© 2024 PredictHQ Ltd