How do I get a full list of sites via the API?
Learn how to retrieve your site information from the Expansive API
List all sites
To list all sites on your Expansive FM platform, use the following request.
Headers
Key | Value |
Authorization | Bearer <TOKEN> (find out more) |
Content-Type | application/vnd.api+json |
Resource
/v2/sites
Method
GET
Expected
Status: 200 OK
{
"jsonapi": {
"version": "1.0"
},
"data": [
{
"type": "sites",
"id": "1",
"attributes": {
"reference": "PRE",
"name": "Expansive HQ",
"address": "5 East Cliff",
"city": "Preston",
"county": "Lancashire",
"postcode": "PR1 3JE",
"currency_id": 67,
"organisation_id": 2,
"country_id": 1,
"latitude": "53.753984",
"longitude": "-2.703279",
"geofence": [
[
53.753966613709,
-2.7037914368854
],
[
53.754191806123,
-2.7034454319225
],
[
53.753942825708,
-2.7029733631359
],
[
53.753708116704,
-2.7033274147259
],
[
53.753966613709,
-2.7037914368854
]
],
"geofence_area": 1500,
"telephone": "0161 987 6000",
"notes": "This is a test site.",
"permit_instructions": "Permit required, arrange at reception.",
"landlord_id": 1,
"site_type_id": 1,
"access_times": [
{
"to": "17:00",
"from": "09:00"
},
{
"to": "17:00",
"from": "09:00"
},
{
"to": "17:00",
"from": "09:00"
},
{
"to": "17:00",
"from": "09:00"
},
{
"to": "17:00",
"from": "09:00"
},
{
"to": "14:00",
"from": "09:30"
},
{
"to": "14:00",
"from": "11:00"
}
],
"test": false,
"created_at": "2024-01-25T14:18:39.000000Z",
"updated_at": "2024-01-25T14:18:39.000000Z",
"built_date": null,
"lease_end_date": null,
"total_space": null,
"usable_space": null,
"number_of_floors": null,
"number_of_parking_spaces": null,
"opening_times": null,
"disabled_access": true,
"number_of_lifts": null,
"hazards": null,
"number_of_meeting_rooms": null,
"number_of_employees": null,
"capacity": null,
"excluded_dates": [],
"timezone": "Europe/London",
"emergency_procedure": "This is the site-level emergency procedure for the site Expansive HQ.",
"emergency_contact_details": "0161 999 6000",
"enabled": true
},
"relationships": {
"Country": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/country",
"self": "http://localhost:8080/api/v2/sites/1/relationships/country"
}
},
"Landlord": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/landlord",
"self": "http://localhost:8080/api/v2/sites/1/relationships/landlord"
}
},
"Organisation": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/organisation",
"self": "http://localhost:8080/api/v2/sites/1/relationships/organisation"
}
},
"SiteType": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/site-type",
"self": "http://localhost:8080/api/v2/sites/1/relationships/site-type"
}
},
"Users": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/users",
"self": "http://localhost:8080/api/v2/sites/1/relationships/users"
}
},
"WorkOrders": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/work-orders",
"self": "http://localhost:8080/api/v2/sites/1/relationships/work-orders"
}
},
"RecurringWorkOrders": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/recurring-work-orders",
"self": "http://localhost:8080/api/v2/sites/1/relationships/recurring-work-orders"
}
},
"Tags": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/tags",
"self": "http://localhost:8080/api/v2/sites/1/relationships/tags"
}
},
"Currency": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/currency",
"self": "http://localhost:8080/api/v2/sites/1/relationships/currency"
}
},
"MaintainableEntity": {
"links": {
"related": "http://localhost:8080/api/v2/sites/1/maintainable-entity",
"self": "http://localhost:8080/api/v2/sites/1/relationships/maintainable-entity"
}
}
},
"links": {
"self": "http://localhost:8080/api/v2/sites/1"
}
},
...
]
}
Sparse field set
You can limit which fields are included in the response with the fields parameter
/v2/sites?fields[sites]=reference,name
This will result in the following below each site's attribute object.
"attributes": {
"reference": "PRE",
"name": "Expansive HQ"
},
Filtering sites
You can filter which sites are returned in the result set using the filter parameter, some commonly used filters are as follows.
/v2/sites?filter[enabled]=true&filter[organisation_id]=2
enabled | boolean |
organisation_id | integer |
reference | string (partial match) |
name | string (partial match) |
county | string (partial match) |
currency_id | integer |
country_id | integer |
site_type_id | integer |
Pagination
The response can be paginated with the following parameters
/v2/sites?page[number]=1&page[size]=25