Implementing a look-up application
Last updated
Last updated
This guide takes you through the process of implementing an identifier look-up web application using the OS Linked Identifiers API example available from the OS-Data-Hub-API-Demos GitHub repository.
This is a relatively simple working example that demonstrates how to use the OS Linked Identifiers API. It is a good place to start understanding how to integrate the API into a web application.
These examples use plain HTML, CSS and JavaScript. You can run them by opening the index.html in each folder, or you can serve the examples using a web server, for example live-server.
OS Linked Identifiers API added to an API project in the OS Data Hub with an API Key. See Getting started with an API project for more information.
An integrated development environment (IDE) like Visual Studio Code.
Open to the OS-Data-Hub-API-Demos GitHub repository.
Click the green Code button.
Click Download ZIP.
Navigate to your Downloads folder and unzip OS-Data-Hub-API-Demos-master.zip
. Put the newly unzipped folder in your IDE project folder.
When you open your IDE, the new files should appear automatically in your project window.
In your IDE navigate to the OSLinkedIdentifiersAPI
folder.
The folders you have installed contains all the coding required to call and interact with the code libraries.
To launch the web-based application navigate to and open the index.html
file in the OSLinkedIdentifiersAPI
folder. Once you've done this, run the application.
Note! The launch method may differ between IDEs. Once you've done this, run the application.
Running the project will launch a window in your browser that looks like this:
The demo application is running on a temporary local server from your own computer. This server is private to your IP address so it cannot be shared with other users. This server will exist as long as your IDE is open. You will have to run the index.html
file through your IDE each time you wish to use the demo.
To use the demo, open up your My projects page on the OS Data Hub and copy your Project API Key.
Paste the key into the Project API Key box on the local server demo
There are four queries to run within the Linked Identifiers API demo application.
To run the first query, you need to enter a linked identifier ID into the input box and click Run query.
To run the second query, you need to select a feature type, enter a linked identifier ID into the input box and click Run query.
To run the third query, you need to select an identifier type, enter a linked identifier ID into the input box and click Run query.
To run the fourth query, you need to select a correlation method type and click Run query.