Getting started with example queries using Node.js

This page provides example queries that you can adapt and use with OS Names API. The examples use Node.js the popular axiosarrow-up-right module.

What you need

Example queries using Node.js

circle-info

These examples rely on a working installation of Node.jsarrow-up-right and the popular axiosarrow-up-right module.

Running a find query

const axios = require('axios');

const apiKey = 'INSERT_YOUR_API_KEY_HERE';

async function find() {
    axios.get('https://api.os.uk/search/names/v1/find?query=Southampton&key=' + apiKey)
    .then(function (response) {
        /* For explanation and debugging purposes we display the full response from the API in the console */
        console.log(JSON.stringify(response.data, null, 2));
    });
}
find()

Running a nearest query.

Last updated

Was this helpful?