-
Notifications
You must be signed in to change notification settings - Fork 43
External Services
BC Geocoder provides address and location data on properties in BC. By supplying a portion of an address, the geocoder will offer ranked, matching address information. In PIMS, this is used to help users find correct addresses for their properties and centre the location of those properties in the correct location.
GET requests must be sent to the geocoder service at https://geocoder.api.gov.bc.ca
.
For addresses, add /addresses.json
, and include the required query parameters.
This service requires an API key that can be obtained directly from them. Include it in the header under apiKey
.
See their Developer Guide for more information.
Here is an example response:
{
"siteId": "c4aed806-f5a4-4ce4-bf67-c55776958f90",
"fullAddress": "4000 Seymour Pl, Saanich, BC",
"address1": "4000 Seymour Pl",
"administrativeArea": "Saanich",
"provinceCode": "BC",
"longitude": -123.3696898,
"latitude": 48.4531151,
"score": 83
}
PIMS often requires details related to mapping layers or property assessment information that must come from outside sources. BC Data Catalogue has many open datasets available for query. These values primarily appear on the map page and can be toggled on or off from the layers menu on the right.
Data from BC Assessment is only available to Administrators who have signed an agreement with BC Assessment directly.
To add a new layer to the map, add an entry to the MapLayers.tsx file. Here is an example:
{
name: 'Current Census Economic Regions',
url: 'https://openmaps.gov.bc.ca/geo/pub/WHSE_HUMAN_CULTURAL_ECONOMIC.CEN_ECONOMIC_REGIONS_SVW/ows?',
layers: 'pub:WHSE_HUMAN_CULTURAL_ECONOMIC.CEN_ECONOMIC_REGIONS_SVW',
}
BC Assessment is called directly. It is required that credentials be included in the request. These credentials are set when logging in via Keycloak. They will not set for developers on their local machines, making this feature difficult to test outside of a live environment.
See the useBCAssessmentApi.ts
file in /react-app
for the usage example.
Common Hosted Email Service (CHES)
PIMS has the requirement to send email notifications during the property disposal project and for certain tasks regarding user access. To accomplish this PIMS uses the government-hosted CHES.
Emails are queued within CHES, and their status is updated accordingly. When users access projects, the notification status within PIMS is synchronized to match.
CHES requires an account setup in order to access their API.
Once access is granted, the username and password must be sent to their authentication URL to obtain a token.
const creds = btoa(`${username}:${password}`);
const headers = {
Authorization: `Basic ${creds}`,
'Content-Type': 'application/x-www-form-urlencoded',
};
const content = new URLSearchParams({
grant_type: 'client_credentials',
});
const result = await fetch(urls.CHES.AUTH, {
headers: headers,
body: content.toString(),
method: 'POST',
});
Use this token in additional requests to their API.
const headers = {
Authorization: `Bearer ${_token.access_token}`,
'Content-Type': 'application/json',
};
const response = await fetch(url, {
headers: headers,
method: method,
body: data ? JSON.stringify(data) : undefined,
});
Possible CHES statuses are:
- Accepted
- Pending
- Cancelled
- Failed
- Completed
By supplying the LTSA API with a PID, we can receive detailed information about selected parcels, such as ownership, sale price, and historical charges on the land.
LTSA uses an OAuth2 authentication system, with different server for Test and Production.
First we must authenticate ourselves with LTSA by making a POST
request to /login/integrator
Test Server: https://appsuat.ltsa.ca/iam/api/auth
Production Server: https://apps.ltsa.ca/iam/api/auth
Body:
{
"integratorUsername": " ",
"integratorPassword": "*****",
"myLtsaUserName": " ",
"myLtsaUserPassword": "*****"
}
Second we must make a GET
request to /titleSummaries
Test Server: https://tduat-x42b.ltsa.ca/titledirect/search/api
Production Server: https://td-x42b.ltsa.ca/titledirect/search/api
Headers:
Accept=application/vnd.ltsa.astra.titleSummaries+json
X-Authorization=Bearer ${access_token}
Query Parameters:
filter=parcelIdentifier:${pid}
3) Order
Third we must make a POST
request to /orders
Test Server: https://tduat-x42b.ltsa.ca/titledirect/search/api
Production Server: https://td-x42b.ltsa.ca/titledirect/search/api
Headers:
Accept=application/vnd.ltsa.astra.orders+json
X-Authorization=Bearer ${access_token}
Body:
{
"order": {
"productType": "title",
"fileReference": "Test",
"productOrderParameters": {
"titleNumber": " ",
"landTitleDistrictCode": " ",
"includeCancelledInfo": false
}
}
}