Endpoints

Geofences

class radar.endpoints.Geofences(radar, requester)[source]
create(data={})[source]

Creates a geofence.

If a geofence with the specified tag and externalId already exists, the request will fail.

https://radar.io/documentation/api#create-geofence

Returns:Geofence
delete(id=None, tag=None, externalId=None)[source]

https://radar.io/documentation/api#delete-geofence

get(id=None, tag=None, externalId=None)[source]

Gets a geofence by id or tag and externalId

https://radar.io/documentation/api#get-geofence

Returns:Geofence
list(limit=None, createdBefore=None, createdAfter=None, tag=None)[source]

Lists geofences. Geofences are sorted descending by createdAt

https://radar.io/documentation/api#list-geofences

Parameters:
  • limit (int, optional (default=100)) – max number of geofences to return.
  • createdBefore (datetime, optional (default=None)) – pagination cursor.
  • createdAfter (datetime, optional (default=None)) – pagination cursor.
  • tag (str, optional (default=None)) – lists geofences with specified tag.
Returns:

list of Geofence

list_users(id=None, tag=None, externalId=None, limit=None, updateBefore=None, updatedAfter=None)[source]

Lists users in a geofence.

The geofence can be uniquely referenced by Radar _id or by tag and externalId. Users are sorted descending by updatedAt.

https://radar.io/documentation/api#list-geofence-users

Returns:list of User
upsert(tag=None, externalId=None, data={})[source]

Upserts a geofence.

If a geofence with the specified tag and externalId already exists, it will be updated. If not, it will be created.

https://radar.io/documentation/api#upsert-geofence

Returns:Geofence

Users

class radar.endpoints.Users(radar, requester)[source]
delete(id=None, userId=None, deviceId=None)[source]

Deletes a user. The user can be referenced by Radar _id, userId, or deviceId

https://radar.io/documentation/api#delete-user

get(id=None, userId=None, deviceId=None)[source]

Gets a user. The user can be referenced by Radar _id, userId, or deviceId

https://radar.io/documentation/api#get-user

Returns:User
list(limit=None, updatedBefore=None, updatedAfter=None)[source]

List users, sorted descending by updatedAt

https://radar.io/documentation/api#list-users

Parameters:
  • limit (int, optional (default=100)) – Max number of users to return.
  • updateBefore (datetime, optional) – A cursor for use in pagination. Retrieves users updated before the specified datetime.
  • updatedAfter (datetime, optional) – A cursor for use in pagination. Retrieves users updated after the specified datetime.
Returns:

list of User

Events

class radar.endpoints.Events(radar, requester)[source]
delete(id)[source]

Deletes an event. The event can be uniquely referenced by Radar _id

https://radar.io/documentation/api#delete-event

get(id)[source]

Gets an event. The event can be uniquely referenced by Radar _id

https://radar.io/documentation/api#get-event

Returns:Event
list(limit=None, createdBefore=None, createdAfter=None)[source]

Lists events. Events are sorted descending by createdAt.

https://radar.io/documentation/api#list-events

Parameters:
  • limit (int, optional (default=100)) – Max number of events to return.
  • createdBefore (datetime, optional) – A cursor for use in pagination. Retrieves events created before the specified datetime.
  • createdAfter (datetime, optional) – A cursor for use in pagination. Retrieves events created after the specified datetime.
Returns:

list of Event

verify(id, verification=None, value=None, verifiedPlaceId=None)[source]

Verifies an event.

Events can be accepted or rejected after user check-ins or other forms of verification. Event verifications will be used to improve the confidence level of future events.

https://radar.io/documentation/api#verify-event

Parameters:
  • id (str) – id of the event to verify
  • verification (str, optional) – one of “accept”, “reject”, “unverify”
  • value (int, optional) – one of 1 (accept), -1 (reject), 0 (unverify)
  • verifiedPlaceId (str, optional) – For user.entered_place events, the ID of the verified place.

Example

>>> radar.events.verify('123', 'accept')
>>> radar.events.verify('123', value=1)

Context

class radar.endpoints.Context(radar, requester)[source]
get(coordinates)[source]

Gets context for a location without sending device or user identifiers to the server.

Parameters:coordinates ((latitude, longitude)) – the coordinates of the location

Examples

>>> radar.context.get(coordinates=(40.123, -73.456))
Returns:object with the radar context for the provided location
Return type:RadarContext

Geocode

class radar.endpoints.Geocode(radar, requester)[source]
forward(query)[source]

Geocodes an address, converting address to coordinates.

https://radar.io/documentation/api#geocode-forward

Parameters:query (str) – The address to geocode.
Returns:list of Address
ip(ip)[source]

Geocodes an IP address, converting IP address to country.

https://radar.io/documentation/api#geocode-ip

Parameters:ip (str) – The IP address to geocode.
Returns:list of Address
reverse(coordinates)[source]

Reverse geocodes a location, converting coordinates to address.

https://radar.io/documentation/api#geocode-reverse

Parameters:coordinates ((latitude, longitude)) – the coordinates to reverse geocode
Returns:list of Address

Route

class radar.endpoints.Route(radar, requester)[source]
distance(origin, destination, modes, units='metric')[source]

Calculates the travel distance and duration between two locations.

https://radar.io/documentation/api#route-distance

Parameters:
  • origin (str) – The origin. A string in the format latitude,longitude.
  • destination (str) – The destination. A string in the format latitude,longitude.
  • modes (str) – The travel modes. A string, comma-separated, including one or more of foot, bike, car, and transit.
  • units (str, optional (default="metric")) – The distance units. A string, metric or imperial.
Returns:

Routes