Place

Places are point-of-interests or geographical areas. Use places to set expected_place for Actions, or to autocreate actions using geofence.

The Place object

Property Type Description
id uuid string Unique identifier for the object, set by HyperTrack
unique_id string An identifier for the place based on your internal id
name string The name of the entity, eg, Head office, Sam's Home, Walmart Milpitas
location GeoJSON Location in GeoJSON format. Read more
display_text string Well formatted display text of the place derived using all the other string properties of this object. If name is available then it is set as this property's value, otherwise locality is used if it is available, otherwise address is used if it is available and so on. Its a read-only property that you cannot patch. It is useful in displaying place in visuals
address string Street address of the object
landmark string Landmark near the object
zip_code string Zip or postal code of the object
city string City of the object
state string State of the object
country string Country of the object
created_at ISO datetime string Timestamp of when the object was created

Locations

The location parameter within the Place object uses GeoJSON format. In GeoJSON, the coordinates are represented as [longitude, latitude]. This is different from [latitude, longitude] which is used in the Google Maps APIs . Know more GeoJSON here.

Type of supported locations:

  1. Point

    "location": {
     "type": "Point",
     "coordinates": [-122.4027468,37.7887655]
    }
    
  2. Polygon

    "location": {
     "type": "Polygon",
     "coordinates": [
     [
     [100.0, 0.0],
     [101.0, 0.0],
     [101.0, 1.0],
     [100.0, 1.0],
     [100.0, 0.0]
     ]
     ]
    }
    

Create Places

Creates one or more new placed. The request body consists of a list of objects. One place is created for each object as per the parameters of the object.

HTTP Request

POST https://api.hypertrack.com/api/v2/places/

Returns

Returns a place object if the call succeeded.

Parameters

All parameters are optional.

Property Type
name string
unique_id string
location GeoJSON point or polygon
address string
landmark string
zip_code string
city string
state string
country string

[info] Geocoding

When the latitude-longitude is specified in location field, it is assumed to be the exact location. If it is not specified, then the address field is used to geocode the place, and the geocoded latitude-longitude is saved as the location property. Although most of the data is optional, the estimated latitude-longitude improves when more data is provided.

curl -H "Authorization: token PUBLISHABLE_KEY" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"address\": \"270 Linden Street\", \"city\": \"San Francisco\"}" \
     https://api.hypertrack.com/api/v2/places/
place = hypertrack.Place.create(address='270 Linden Street', city='San Francisco')
hypertrack.places
    .create({
        "address":"270 Linden Street",
        "city": "San Francisco"
    });
HyperTrackClient client = new HyperTrackClient("PUBLISHABLE_KEY");
PlaceFactory placeFactory = new PlaceFactory(client);
Map<String, Object> params = new HashMap<>();
params.put("address", "270 Linden Street");
Place place = placeFactory.create(params);

Retrieve a Place

Retrieves the details of an existing place.

HTTP Request

GET https://api.hypertrack.com/api/v2/places/<id>/

Returns

Returns a places object if a valid identifier was provided.

curl -H "Authorization: token PUBLISHABLE_KEY" \
     https://api.hypertrack.com/api/v2/places/15ce9cdc-1409-4976-a260-dc0e5b2445ac/
place = hypertrack.Place.retrieve('15ce9cdc-1409-4976-a260-dc0e5b2445ac')
hypertrack.places
    .retrieve("15ce9cdc-1409-4976-a260-dc0e5b2445ac")
    .then(function(place) {})
HyperTrackClient client = new HyperTrackClient("SECRET_KEY");
PlaceFactory placeFactory = new PlaceFactory(client);
Place place = placeFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");

Update a Place

Edit an existing place object.

HTTP Request

PATCH https://api.hypertrack.com/api/v2/places/<id>/

Returns

Returns the updated place object.

Parameters

All parameters are optional.

Property Type
name string
unique_id string
location GeoJSON point or polygon
address string
landmark string
zip_code string
city string
state string
country string
unique_id string
radius integer
curl -H "Authorization: token SECRET_KEY" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"customer_id\": \"98241a3b-82bf-46c5-8dea-61377c546c5e\"}" \
     https://api.hypertrack.com/api/v2/places/15ce9cdc-1409-4976-a260-dc0e5b2445ac/
place = hypertrack.Place.retrieve('15ce9cdc-1409-4976-a260-dc0e5b2445ac')
place.name = 'Hub 1'
place.save()
hypertrack.places
    .update(
        "15ce9cdc-1409-4976-a260-dc0e5b2445ac",
        {
            "name": "Hub 1"
        }
    );
HyperTrackClient client = new HyperTrackClient("SECRET_KEY");
PlaceFactory placeFactory = new PlaceFactory(client);
Place place = placeFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");
Map<String, Object> newParams = new HashMap<>();
newParams.put("name", "Hub 1");
placeFactory.patch(place, newParams);

List all Places

Returns a list of your places.

HTTP Request

GET https://api.hypertrack.com/api/v2/places/

Returns

Returns a list of places.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
min_created_at No Filter objects by minimum created at date
max_created_at No Filter objects by maximum created at date
curl -H "Authorization: token SECRET_KEY" \
     https://api.hypertrack.com/api/v2/places/
places = hypertrack.Place.list()
hypertrack.places.list()
    .then(function(places) {})
HyperTrackClient client = new HyperTrackClient("SECRET_KEY");
PlaceFactory placeFactory = new PlaceFactory(client);
HyperTrackArrayList<Place> places = placeFactory.list();

results matching ""

    No results matching ""