Accessing the Local Knowledge Web Service
Local Knowledge queries are normally run within the WebMap interface. But it is possible to get Local Knowledge results without viewing a map; to do this use the HTTP POST requests directly against the Local Knowledge web service.
Managing API keys
Cadcorp recommends issuing an API key to any application (Local Knowledge, Quick Search) that wants to use the API.
Click Security > Configuration > API Keys. Here API Keys can be created, modified and removed.
To use the API key add an x-api-key header, the value should be the key generated in the Manager.
Here are a few queries that can be defined on data layers:
Access Local Knowledge
| Path | https://<server>/<app>//Localknowledge/api |
| Request Type | GET |
| Response |
Gets a JSON list of available maps which have the local knowledge extension enabled.
|
Initialize a Local Knowledge Session
| Path | https://<server/<app>/localknowledge/api/<mapname>/sessions |
| Request Type | POST |
| Response |
Returns a unique session ID to be used in further Local Knowledge queries. Note that after 20 minutes of no use, this session will be destroyed and a new one will need to be created. |
| Additional Information |
|
Find queryable overlays for Local Knowledge
| Path | https://<server/<app>/localknowledge/api/<mapname>/sessions/<sessionid>/overlays |
| Request Type | GET |
| Response |
Gets a JSON list of overlays that can be queried:
|
Perform a Local Knowledge Query
| Path | https://<server>/<app>/localknowledge/api/<mapname>/sessions/<sessionid> /query/<layerindex>?x=<x coordinate>&y=<y coordinate>&epsgcode=<epsgcode>&bbox=<bounding box> |
| Request Type | GET |
| Response |
Gets a JSON-formatted list of corresponding Local Knowledge entries, relevant to the type of query carried out. |
| Additional Information |
The
|
Keep Local Knowledge Session Alive
| Path | https://<server>/<app>/localknowledge/api/<mapname>/<sessionid>/ping |
| Request Type | GET |
| Response |
Will prevent current session from expiring, if still active. |