Update a Saved Location
Update (replace) an existing Saved Location.
PUT https://api.predicthq.com/v1/saved-locations/$location_id
Parameter | Description |
---|---|
location_id | An existing Saved Location ID. |
Header | Value |
---|---|
Content-Type | application/json |
This endpoint accepts the same request body fields as the Create a Saved Location endpoint. Please refer to the Create a Saved Location documentation for request body parameters.
Remember this is a PUT endpoint which means you must provide all supported fields or you may lose data - you are effectively replacing the existing record with a new record containing all the fields you provide. We recommend first getting the existing record and pre-populating the request body with the current values, then change the fields you need to change.
If successful, the HTTP response code will be
204 No Content
.curl
python
curl --location --request PUT 'https://api.predicthq.com/v1/saved-locations/5BcRstnNPjXl-fiB_0TQJg' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data '{
"name": "S Las Vegas Blvd, Las Vegas (NV), US",
"labels": [],
"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/5BcRstnNPjXl-fiB_0TQJg"
payload = json.dumps({
"name": "S Las Vegas Blvd, Las Vegas (NV), US",
"labels": [],
"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("PUT", url, headers=headers, data=payload)
print(response.text)
Below are some guides relevant to this API:
Last modified 2mo ago