Create a Saved Location
Create a new Saved Location to begin seeing insights.
POST https://api.predicthq.com/v1/saved-locations
Header | Value |
---|---|
Content-Type | application/json |
Field | Description |
---|---|
name
string
required | Name of the Saved Location.
E.g. My Location |
description
string | Description of the location. |
location_code
string | An optional identifier for your location.
The intention here is to use your own identifier for the location if you have one. E.g., you might have stores/hotels/etc in your system with their own ID - use that ID here to make it easier to lookup the location later. |
labels
array | A list of labels to help you categorize your locations. You can use these labels to search upon.
E.g. { "labels": ["label1", "label2"] } |
geojson
object | You can define the geolocation of the Saved Location either by GeoJSON or Place IDs. When using GeoJSON please note the following:
As always, we strongly recommend using our Suggested Radius API to work out a suitable radius value for your location. E.g. { "geojson": { "type": "Feature", "properties": { "radius": 1, "radius_unit": "mi" }, "geometry": { "type": "Point", "coordinates": [ -115.1728484, 36.1147065 ] } } } |
place_ids
array | You can define the geolocation of the Saved Location either by GeoJSON or Place IDs. The Place IDs option is typically used when the location covers an entire city, county, state or country. E.g. { "place_ids": [2750405] } |
curl
python
curl --location 'https://api.predicthq.com/v1/saved-locations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data '{
"name": "Example of creating a saved location",
"geojson": {
"type": "Feature",
"properties": {
"radius": 1,
"radius_unit": "mi"
},
"geometry": {
"type": "Point",
"coordinates": [
-115.1728484,
36.1147065
]
}
}
}'
import requests
import json
url = "https://api.predicthq.com/v1/saved-locations"
payload = json.dumps({
"name": "Example of creating a saved location",
"geojson": {
"type": "Feature",
"properties": {
"radius": 1,
"radius_unit": "mi"
},
"geometry": {
"type": "Point",
"coordinates": [
-115.1728484,
36.1147065
]
}
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
curl
python
curl --location 'https://api.predicthq.com/v1/saved-locations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data '{
"name": "Test with place_id",
"place_ids": [ 2750405 ]
}'
import requests
import json
url = "https://api.predicthq.com/v1/saved-locations"
payload = json.dumps({
"name": "Example with place_id",
"place_ids": [
2750405
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Below are some guides relevant to this API:
Last modified 2mo ago