Skip to main content

Selecting Filters

This section will demonstrate how to use filters for API requests. There are two steps for adding any filter. The first step is selecting the parameter which will give the API the required level of aggregation, and the second is to apply the filter. Ensure that you make a POST request, not GET.

Adding a Single Filter

The endpoint and query string to return the Job Posting Counts in July-2022 at a census divison level is:

https://lmic-datahub-prod-gw-d6ow9n6v.uc.gateway.dev/lmi?indicator=14&start=20220701&end=20220701&geo=census_division

This query will return the Job Posting Counts for every census region. If the user wants to return only certain census regions, they must use a filter.

Navigate to the body of your request and enter the following:

{"census_division":["Greater Vancouver"]}

To filter for another region, follow the formatting as follows:

{"census_division":["Greater Vancouver","Baffin"]}

Request & response overview

The API request filtering for Greater Vancouver and Baffin resembles:

curl --location --request POST 'https://lmic-datahub-prod-gw-d6ow9n6v.uc.gateway.dev/lmi?indicator=14&start=20220701&end=20220701&geo=census_division' \
--header 'x-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"census_division":["Greater Vancouver","Baffin"]}'

Ensure the header: 'Content-Type: application/json' is added for all requests so that the API reads the JSON body where the filter is located in the request.

The response:

{
"data": [
{
"source": "Vicinity Jobs",
"ref_date": "2022-07-31",
"data_frequency": "monthly",
"noc_code": "",
"noc_level": null,
"noc_title_en": "",
"country": "Canada",
"provinces_territories": "BC",
"economic_regions_en": "Mainland/Southwest",
"census_division": "Greater Vancouver",
"location": null,
"indicator_name_en": "Job postings count",
"indicator_value": 29152
},
{
"source": "Vicinity Jobs",
"ref_date": "2022-07-31",
"data_frequency": "monthly",
"noc_code": "",
"noc_level": null,
"noc_title_en": "",
"country": "Canada",
"provinces_territories": "NU",
"economic_regions_en": "Nunavut",
"census_division": "Baffin",
"location": null,
"indicator_name_en": "Job postings count",
"indicator_value": 310
}
],
"meta": {
"current_page": 1,
"total_pages": 1,
"per_page": 1000,
"total_rows": 2
}
}

Adding Multiple Filters

Following on from the previous example, add another filter by following the notation below:

{"census_division":["Greater Vancouver","Baffin"],"noc":["1"]}

Before sending this API request, ensure that the parameter noc_level=1 is specified so the API can aggregate the response by noc as well as census_divison. noc_level=1 specifies the most broad occupational level, and "noc":["1"] specifies the occupational category 'Business, finance and administration occupations'.

Request & response overview

The API request filtering for Greater Vancouver and Baffin for noc 1 resembles:

curl --location --request POST 'https://lmic-datahub-prod-gw-d6ow9n6v.uc.gateway.dev/lmi?indicator=14&start=20220701&end=20220701&geo=census_division&noc_level=1' \
--header 'x-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"census_division":["Greater Vancouver","Baffin"],"noc":["1"]}'

The API response:

    {
"data": [
{
"source": "Vicinity Jobs",
"ref_date": "2022-07-31",
"data_frequency": "monthly",
"noc_code": "1",
"noc_level": 1,
"noc_title_en": "Business, finance and administration occupations",
"country": "Canada",
"provinces_territories": "BC",
"economic_regions_en": "Mainland/Southwest",
"census_division": "Greater Vancouver",
"location": null,
"indicator_name_en": "Job postings count",
"indicator_value": 5380
},
{
"source": "Vicinity Jobs",
"ref_date": "2022-07-31",
"data_frequency": "monthly",
"noc_code": "1",
"noc_level": 1,
"noc_title_en": "Business, finance and administration occupations",
"country": "Canada",
"provinces_territories": "NU",
"economic_regions_en": "Nunavut",
"census_division": "Baffin",
"location": null,
"indicator_name_en": "Job postings count",
"indicator_value": 50
}
],
"meta": {
"current_page": 1,
"total_pages": 1,
"per_page": 1000,
"total_rows": 2
}
}