The following article should outline how the V4 Inspections API can be used to retrieve property inspections. Currently the API only allows you to retrieve information relating to inspections appointments set up in the system.
Retrieving Inspection Appointments
To retrieve an appointment through the API, you first need to retrieve the correct appointment types to query. The appointment types can be retrieved by using the following endpoint:
GET /v4/inspections/{shortName}/diary/appointmenttypes/{offset}/{count}
This endpoint will return a collection of all the appointment types set up in the system. From this response, you will need to retain the OID's of all the appointment types you wish to query.
With this information, you will then be able to query the API for all instances of these appointments within a date period. This can be done using the following endpoint:
GET /v4/inspections/{shortName}/diary/appointments/{offset}/{count}
This will return a collection of appointments that occur within the search date range. An appointment can occur within the search date range in one of two ways. The first way is if an appointment is scheduled within the two dates. The second way it may appear is if a recurring appointment is created, and the date of the next recurring appointment falls within the date search range. In instances where the NextRecurringDate field is not null, this field should be used instead of the appointment start date.
Retrieving Staff Members
The appointment will return a staff member ID. More information surrounding the staff member who conducted the inspection can be retrieved by passing the staff member ID into the following endpoint.
GET /v4/inspections/{shortName}/contacts/staff/{staffID}
This will return all the relevant information of the staff member associated with the ID.
Retrieving Inspection Property Information
After retrieving an inspection appointment, additional information can be returned by retaining the property ID from the appointment, and passing it into the following endpoint.
GET /V4/inspections/{shortName}/properties/{propertyID}
This will return information associated with the property being inspected in the appointment. The result of this will return a landlord ID, which can be used to retrieve the landlord details of the property using the following endpoint.
GET /v4/inspections/{shortName}/contacts/landlords/{landlordID}
The property endpoint also returns the ID of the latest tenancy on a property, which can be used to retrieve the information surrounding the latest tenancy on the system related to the property. The latest tenancy information can be retrieved using the following the endpoint.
GET /v4/inspections/{shortName}/tenancies/{tenancyID}
It is also possible to retrieve the tenants linked to a tenancy by passing the tenancy ID into the following endpoint.
GET /v4/inspections/{shortName}/tenancies/{tenancyID}/tenants
This will return all tenants belonging to the tenancy.
Retrieving Historic Inspection Property Information
With appointments that have occurred in the past, you might wish to retrieve the landlord and tenancy at the period of the appointment, and not the latest information linked to the property. This can be achieved by retrieving the property from the appointment, the same as above. After the property is achieved, the property ID can be passed into the following endpoint, alongside the start and end date you wish to query, to retrieve the landlord during that period of time.
GET /V4/inspections/{shortName}/properties/{propertyID}/landlord/period
Tenancy information between two dates can be achieved by passing the property ID and two dates into the following endpoint.
GET /V4/inspections/{shortName}/properties/{propertyID}/tenancies/period
Retrieving all other information surrounding the tenancy should be the same as outlined in getting the current inspection property information.
Uploading Inspection Reports
Uploading inspection reports is still currently under development.
Comments
0 comments
Please sign in to leave a comment.