Locations

Each OnLocation account is made up of one or more locations. A location record contains the name, contact details, timezone, date format, employee count, and the access points set up for that location.

Use the location API to retrieve your location list, add a new location, or update or delete an existing location.

Learn more about the information that's captured for each location in the OnLocation Help Center.

List all locations

Retrieves a list of all locations.

A comma separated list of tag:value search parameters, a colon separator performs an exact match, a percent separator performs a starts-with search and greater/less than search number/date ranges.

Request
query Parameters
q
string <string>

Filter by location details, eg country, staff count

Example: q=staff_count>200
Responses
200

List of locations

403

Access denied to this resource

404

Resource not found

500

Internal server error

get/location
Request samples
curl -i -X GET \
  'https://api.whosonlocation.com/v1/location?q=string'
Response samples
[
  • {
    }
]

Create a location

Adds a new location to an account.

Request
Request Body schema:

Location details:

name
string <string>
address
string <string>
phone
string <string>
postcode
string <string>
country
string <string>
timezone
string <string>
date_format
string <string>
Responses
201

Location created

403

Access denied to this resource

500

Internal server error

post/location
Request samples
{
  • "name": "Head Office",
  • "address": " 1008 Tawa Terrace, Tawa, Wellington, New Zealand",
  • "phone": "+1 206 555 0123",
  • "postcode": "5021",
  • "country": "NZ",
  • "timezone": "Pacific/Auckland",
  • "date_format": "d/m/Y"
}
Response samples
{
  • "id": 301,
  • "created": "2021-08-12T09:26:54+12:00",
  • "modified": "2021-09-03T09:26:54+12:00",
  • "name": "Head Office",
  • "address": " 1008 Tawa Terrace, Tawa, Wellington, New Zealand",
  • "phone": "+1 206 555 0123",
  • "external_id": "998",
  • "postcode": "5021",
  • "country": "NZ",
  • "timezone": "Pacific/Auckland",
  • "date_format": "d/m/Y",
  • "staff_count": 13,
  • "lacps": [
    ]
}

Retrieves a location

Returns the details of a single location, based on the ID provided.

Request
path Parameters
id
required
integer <int32>

ID of location to retrieve

Responses
200

Location response

403

Access denied to this resource

404

Resource not found.

500

Internal server error.

get/location/{id}
Request samples
curl -i -X GET \
  https://api.whosonlocation.com/v1/location/:id
Response samples
{
  • "id": 301,
  • "created": "2021-08-12T09:26:54+12:00",
  • "modified": "2021-09-03T09:26:54+12:00",
  • "name": "Head Office",
  • "address": " 1008 Tawa Terrace, Tawa, Wellington, New Zealand",
  • "phone": "+1 206 555 0123",
  • "external_id": "998",
  • "postcode": "5021",
  • "country": "NZ",
  • "timezone": "Pacific/Auckland",
  • "date_format": "d/m/Y",
  • "staff_count": 13,
  • "lacps": [
    ]
}

Update a location

Updates a location's details.

Request
path Parameters
id
required
integer <int32>

ID of the location to update

Request Body schema:

Location details:

name
string <string>
address
string <string>
phone
string <string>
postcode
string <string>
country
string <string>
timezone
string <string>
date_format
string <string>
Responses
204

Updated location

403

Access denied to this resource

500

Internal server error

put/location/{id}
Request samples
{
  • "name": "Head Office",
  • "address": " 1008 Tawa Terrace, Tawa, Wellington, New Zealand",
  • "phone": "+1 206 555 0123",
  • "postcode": "5021",
  • "country": "NZ",
  • "timezone": "Pacific/Auckland",
  • "date_format": "d/m/Y"
}

Delete a location

Remove a location from the account.

Request
path Parameters
id
required
integer <int32>

ID of location to delete

Responses
204

Location deleted

403

Access denied to resource

404

Resource not found

delete/location/{id}
Request samples
curl -i -X DELETE \
  https://api.whosonlocation.com/v1/location/:id