Exploring Open Notify API

Open Notify API is a public API that provides information about the International Space Station (ISS) and people in space. This API is available for developers to access through HTTP GET requests.

The Open Notify API can be accessed at http://open-notify.org/Open-Notify-API/. In this blog post, we will explore the different endpoints of this API and write code examples in JavaScript.

Endpoints

ISS Location endpoint

The ISS Location endpoint returns the current location of the International Space Station.

fetch('http://api.open-notify.org/iss-now.json')
    .then(response => response.json())
    .then(data => console.log(data));

ISS Pass Times endpoint

The ISS Pass Times endpoint returns the next time the International Space Station will pass over a given location.

const latitude = 51.5007; // London
const longitude = -0.1246;
const url = `http://api.open-notify.org/iss-pass.json?lat=${latitude}&lon=${longitude}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data));

People in Space endpoint

The People in Space endpoint returns the names of the people currently in space.

fetch('http://api.open-notify.org/astros.json')
    .then(response => response.json())
    .then(data => console.log(data));

Conclusion

In this blog post, we explored the different endpoints of the Open Notify API and wrote code examples in JavaScript. This API provides a simple way to access information about the International Space Station and people in space.

Related APIs in Science