Quickstart Guide

Welcome to the WasteHero API Quickstart Guide. As this is a quickstart guide, we'll jump right in:

Which programming language should you use?

The API reference page provides examples in many different languages, and as long as your language of choice can make HTTP requests, you should be good to go. In this guide, we'll be using Python with the requests library.

API key

The first thing you will need is an API key. To find the API key follow the step-by-step guide here.

Using the API

The API key is what allows you to access the information for your project, and therefore must be sent with every API request. To do this, you simply add the key to the request header as X-Api-Key.

headers = {
    "Accept": "application/json",
    "X-API-Key": "YOUR-API-KEY-HERE"
}

To make sure it works, lets try querying your projects. The endpoint for this is Get Projects.

import requests

url = "http://platform-api.wastehero.io/api/v3/project/"

headers = {
    "Accept": "application/json",
    "X-API-Key": "YOUR-API-KEY-HERE"
}

response = requests.get(url, headers=headers)

print(response.text)

You should see your project info being displayed in a JSON format (see below for an example).

[
  {
    "id": "A UNIQUE ID FOR YOUR PROJECT",
    "name": "YOUR-PROJECT-NAME",
    "description": "This is where your project description will be",
    "creating_demo_data": false
  }
]

You may find that there are several projects listed in the response. This is because you have access to several projects, and the endpoint will list them all.

What's next?

We have seen how to access the WasteHero API, and how to find the API key that is required to access it.

The API calls we have made here are not the most exciting, so why not take a look at Creating a Route to see how to use the API to setup a route.

If you just want to see which endpoints are available, head over to the API reference page.