Skip to content

API Specification

Mark Lisé edited this page Dec 14, 2023 · 6 revisions

Note: All api calls require setting of the header Authorization: None. Non-sysadmins (3rd party subscribers) cannot search for pending records.

Getting web app configuration

GET /api/config (Get Web Configuration)
Query String Parameters

None

Headers

None

Responses
http code content-type
200 application/json
Show example response
{
   "code": 200,
   "data": {
       "KEYCLOAK_URL": "https://dev.loginproxy.gov.bc.ca/auth",
       "KEYCLOAK_ENABLED": true,
       "KEYCLOAK_REALM": "bcparks-service-transformation",
       "KEYCLOAK_CLIENT_ID": "data-register",
       "API_KEY": <API KEY>,
       "ENVIRONMENT": "dev",
       "configEndpoint": true,
       "logLevel": 0,
       "sk": "config",
       "API_LOCATION": "https://zloys5cfvf.execute-api.ca-central-1.amazonaws.com",
       "pk": "config",
       "API_PATH": "/api"
   },
   "msg": "Success",
   "error": null
}
 curl "https://dev-data.bcparks.ca/api/config -H "accept: application/json"

Get all park names

GET /api/parks/names (Get All Park Name information)
Query String Parameters

Note: At least one of the below parameters are required: Choose either 'status' or 'legalName'.

name type data type description
legalName optional string Provide text to search across the entire database
status optional string Comma separated list of statuses: established,pending,repealed
Headers
name type data type description
Authorization required string Use the string None
x-api-key required string Provide the api key given to you by the data register team
Responses
http code content-type
200 application/json
 curl "https://dev-data.bcparks.ca/api/parks/names?legalName=Golden Ears Park" -H "authorization: None" -H "accept: application/json" -H "x-api-key: <YOUR_API_KEY>"

Get specific park information

GET /api/parks/{identifier}/name (Get Specific Park Name information)

Substitute {identifier} with either 0-prefixed numbers, or non-zero prefixed numbers. e.g. 0001 is equivalent to 1

Query String Parameters
name type data type description
status optional string Comma separated list of statuses: established,pending,repealed
Headers
name type data type description
Authorization required string Use the string None
x-api-key required string Provide the api key given to you by the data register team
Responses
http code content-type
200 application/json
Example cURL request to the registry
 curl "https://dev-data.bcparks.ca/api/parks/0001/name?status=established" -H "authorization: None" -H "accept: application/json" -H "x-api-key: <YOUR_API_KEY>"

Update specific park information

PUT /api/parks/{identifier}/name (Update Specific Park Name information)

Substitute {identifier} with either 0-prefixed numbers, or non-zero prefixed numbers. e.g. 0001 is equivalent to 1

Query String Parameters
name type data type description
updateType required string Choose one of the following: major,minor,repeal
Headers
name type data type description
Authorization required string Use the JWT from the OAuth login from KeyClaok
x-api-key required string Provide the api key given to you by the data register team
Post Body

The post body will contain all the infomr

Responses
http code content-type
200 application/json
Example cURL request to the registry
 curl -X PUT "https://dev-data.bcparks.ca/api/parks/0001/name?status=established" -H "authorization: None" -H "accept: application/json" -H "x-api-key: <YOUR_API_KEY>"

Searching the data register

GET /api/search (Search the data register)
Query String Parameters
name type data type description
text required string Provide text to search across the entire database
type optional string protectedArea is the only option at this time
status optional string Comma separated list of statuses: established,pending,repealed
Headers
name type data type description
Authorization required string Use the string None
x-api-key required string Provide the api key given to you by the data register team
Responses
http code content-type
200 application/json
Show example response
{
    "code": 200,
    "data": {
        "total": {
            "value": 2,
            "relation": "eq"
        },
        "max_score": 6.8208785,
        "hits": [
            {
                "_index": "main-index",
                "_id": "8#Details",
                "_score": 6.8208785,
                "_source": {
                    "updateDate": "2023-12-08T00:23:47.720Z",
                    "notes": "",
                    "phoneticName": "",
                    "searchTerms": "",
                    "displayName": "Golden Ears Park",
                    "lastModifiedBy": "noreply@gov.bc.ca",
                    "audioClip": "",
                    "type": "protectedArea",
                    "legalName": "Golden Ears Park",
                    "sk": "Details",
                    "pk": "8",
                    "displayId": "0008",
                    "effectiveDate": "2023-12-03",
                    "createDate": "2023-09-15T17:13:14.633Z",
                    "status": "repealed"
                }
            },
            {
                "_index": "main-index",
                "_id": "1080#Details",
                "_score": 5.516701,
                "_source": {
                    "updateDate": "2023-12-11T19:46:03.536Z",
                    "phoneticName": "",
                    "searchTerms": "test",
                    "displayName": "Golden Gate/Xáat Yádi Aani Conservancy abc",
                    "lastModifiedBy": "noreply@gov.bc.ca",
                    "audioClip": "",
                    "type": "protectedArea",
                    "legalName": "Golden Gate/Xáat Yádi Aani Conservancy",
                    "sk": "Details",
                    "pk": "1080",
                    "displayId": "1080",
                    "effectiveDate": "2012-05-31",
                    "createDate": "2023-09-15T17:13:14.633Z",
                    "status": "established"
                }
            }
        ]
    },
    "msg": "Success",
    "error": null
 }
Example cURL request to the registry
 curl "https://dev-data.bcparks.ca/api/search?text=Golden" -H "authorization: None" -H "accept: application/json" -H "x-api-key: <YOUR_API_KEY>"