Location departments

Departments are used to assign employees to different operational areas of a location. Use the API to retrieve a list of all departments, create new departments and the locations they apply to, update the department names, or remove them from your account.

Learn more about departments in the OnLocation Help Center.

List all departments

Returns a list of departments for the organization. Each department indicates which locations it has been added to.

Responses
200

List of departments

403

Access denied to this resource

404

Resource not found

get/department
Request samples
curl -i -X GET \
  https://api.whosonlocation.com/v1/department
Response samples
[
  • {
    }
]

Create a department

Add a new department, details include the name and locations.

Request
Request Body schema: application/json

Department to save to the database:

name
string <string>
Responses
201

Department created

403

Access denied to this resource

500

Internal server error

post/department
Request samples
application/json
{
  • "name": "Department of Examples"
}
Response samples
{
  • "id": 1658,
  • "created": "2021-08-12T10:54:13+12:00",
  • "modified": "2021-08-13T10:54:13+12:00",
  • "name": "Administration",
  • "locations": [
    ]
}

Retrieve a department

Retrieves a single department, filtering with the provided ID.

Request
path Parameters
id
required
integer <int32>

ID of the department to retrieve

Responses
200

Department returned

403

Access denied to resource

404

Resource not found

get/department/{id}
Request samples
curl -i -X GET \
  https://api.whosonlocation.com/v1/department/:id
Response samples
{
  • "id": 1658,
  • "created": "2021-08-12T10:54:13+12:00",
  • "modified": "2021-08-13T10:54:13+12:00",
  • "name": "Administration",
  • "locations": [
    ]
}

Update a department

Updates a department with the submitted data, using the provided ID.

Request
path Parameters
id
required
integer <int32>

ID of the department to update

Request Body schema: application/json

Department to save to the database

name
string <string>
Responses
204

Department updated

403

Access denied to this resource

500

Internal server error

put/department/{id}
Request samples
application/json
{
  • "name": "Department of Examples"
}

Delete a department

Removes a department using the provided ID.

Request
path Parameters
id
required
integer <int32>

ID of the department to delete

Responses
204

Department deleted

403

Access denied to resource

404

Resource not found

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