Using the DroneStre.am Public API - Examples in JavaScript

DroneStre.am is a public API service that provides real-time drone footage of various locations around the world. In this tutorial, we'll explore how to use the DroneStre.am public API to retrieve drone footage data using JavaScript.

Getting Started

Before we get started, we need to register an account on the DroneStre.am website and obtain an API key. Once we have that, we can start using the API.

API Endpoint

The API endpoint for DroneStre.am public API is https://api.dronestre.am/. The API provides two main endpoints that we'll use in this tutorial:

  • /data – This endpoint retrieves data for all drone missions.
  • /data/:id – This endpoint retrieves data for a specific drone mission.

Retrieving Data for All Drone Missions

To retrieve data for all drone missions, we'll use the fetch API in JavaScript to send a GET request to the API endpoint and parse the JSON response.

fetch('https://api.dronestre.am/data')
    .then(response => response.json())
    .then(data => {
        // Do something with data
    })
    .catch(error => console.error(error));

In the above example, we're sending a GET request to the /data endpoint. Once we receive the response, we're parsing it as a JSON object and doing something with the data.

Retrieving Data for a Specific Drone Mission

To retrieve data for a specific drone mission, we'll use the fetch API again but this time, we'll append the ID of the mission to the API endpoint.

fetch('https://api.dronestre.am/data/:id')
    .then(response => response.json())
    .then(data => {
        // Do something with data
    })
    .catch(error => console.error(error));

In the above example, we're appending the ID of the drone mission to the API endpoint. Once we receive the response, we're parsing it as a JSON object and doing something with the data.

Conclusion

In this tutorial, we've explored how to use the DroneStre.am public API to retrieve drone footage data using JavaScript. We've covered how to retrieve data for all drone missions and for a specific drone mission. With this knowledge, you can start building your own applications that use real-time drone footage data provided by DroneStre.am.

Related APIs in Data Access