Thanks for your interest in OS Hub's API! This tutorial provides a step-by-step guide for anyone connecting to OS Hub's API using the API platform Postman.
This tutorial is meant to be accessible for all levels of technical proficiency, so that anyone connecting to an API for the first time can follow along. You'll learn how to find your API key on OS Hub, how to make GET calls to search and filter for relevant data, and how to upload facility data to OS Hub with a POST call.
Step 1 - Getting Started with Postman
In this video, we'll:
- Learn what Postman is
- Get started with the browser version of Postman
- Set up a workspace in Postman
Next, we'll retrieve our API key from the OS Hub platform and connect to the API via Postman.
Step 2 - Retrieving your API Key
In this video, we'll:
- Access the OS Hub settings menu
- Generate a token
- Open a request and setting up authentication in Postman
Note: API tokens are unique to the environment. If you are making calls to the staging environment, make sure that you use a token generated on staging. Likewise for production.
Next, we'll send a GET call to the OS Hub API to search for the data we are interested in.
Step 3 - Sending a GET Request
In this video, we'll:
- Make a GET request to retrieve data we're interested in
- Edit the URL to make sure we're sending the call to the right place
- Adding parameters (or search filters) in the "Params" tab of Postman
- Sending our GET request
- Understanding the API response
Next, we'll send a POST request to publish (or upload) facility data to OS Hub.
Step 4 - Sending a POST Request
In this video, we'll:
- Creating a new POST request
- Setting the URL
- Entering our data in JSON format on the "Body" tab of Postman
- Sending our POST request
- Understanding the API response
- Adding additional fields (like sector, product type, parent company, etc.)
- Understanding the updated API response, after we send additional data
For those who aren't familiar with JSON format, the next video show will guide you through how to structure your facility data in JSON format so that you can successfully make POST calls to publish facility data on OS Hub.
Step 5 - Formatting JSON Data
In this video, we'll:
- Discuss how OS Hub's data relates to key-value pairs
- Walk through an example of entering facility data as key-value pairs
- Formatting convention (quotation marks, commas, curly brackets, etc.)