Requesting all Swedish regions
In this example, we want to use the legacy API to obtain all regions in Sweden. We will be using two endpoints to accomplish that:
- https://taxonomy.api.jobtechdev.se/v1/taxonomy/specific/concepts/country
- https://taxonomy.api.jobtechdev.se/v1/taxonomy/specific/concepts/region
In the first step, we will figure out the concept id of Sweden using the first endpoint. In the second step, we will use the second endpoint to query regions in Sweden.
Start by visiting the Swagger page of the API at
https://taxonomy.api.jobtechdev.se/v1/taxonomy/swagger-ui/index.html
Step 1: Obtaining the concept id of Sweden
The specific endpoint that we are going to use to obtain the concept id of Sweden has the following Swagger URL:
Click on the Try it out button. Then click execute. You will see a long list of all countries in the latest version of the taxonomy. The URL of the request is
https://taxonomy.api.jobtechdev.se/v1/taxonomy/specific/concepts/country
In order to only obtain Sweden in the result list, set the preferred-label
parameter to be Sverige
. The corresponding URL is
https://taxonomy.api.jobtechdev.se/v1/taxonomy/specific/concepts/country?preferred-label=Sverige
and we obtain the result
[
{
"taxonomy/type": "country",
"taxonomy/definition": "Sverige",
"taxonomy/id": "i46j_HmG_v64",
"taxonomy/iso-3166-1-alpha-3-2013": "SWE",
"taxonomy/iso-3166-1-alpha-2-2013": "SE",
"taxonomy/preferred-label": "Sverige"
}
]
with Sweden having the concept id i46j_HmG_v64
.
Step 2: Obtaining all regions in Sweden
Visit the Swagger page for regions and click on the button Try it out:
Then click on the button Execute which will return all regions in the world. For instance, we will obtain the following region in the result set:
{
"taxonomy/type": "region",
"taxonomy/definition": "Erzincan",
"taxonomy/id": "CsrW_6th_DKs",
"taxonomy/preferred-label": "Erzincan"
}
The corresponding URL can be found under Request URL in the Swagger UI: https://taxonomy.api.jobtechdev.se/v1/taxonomy/specific/concepts/region
We want to restrict the set of regions to the set of concepts being narrower to the concept with id i46j_HmG_v64
that represents Sweden. In order to do that, set the relation
parameter to be narrower
and the related-ids
parameter to be i46j_HmG_v64
. Then execute the request. The corresponding URL is
and the results will now only contain Swedish regions, such as
{
"taxonomy/type": "region",
"taxonomy/definition": "Kalmar län",
"taxonomy/id": "9QUH_2bb_6Np",
"taxonomy/national-nuts-level-3-code-2019": "08",
"taxonomy/nuts-level-3-code-2013": "SE213",
"taxonomy/preferred-label": "Kalmar län"
}