Divesites API

Divesites API

Sports & Fitness

Returns database information for scuba divers including location, weather, latitude and longitude, map, and tide stations.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Divesites API

🚀 Quick Start Examples

Divesites API Javascript Examplejavascript
// Divesites API API Example
const response = await fetch('http://api.divesites.com/docs/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Divesites API: A Comprehensive Guide

Divesites is a public API providing access to information on thousands of dive sites worldwide. In this article, we will guide you through the API documentation and demonstrate how to use it using JavaScript.

API Key

Before you can access any of the Divesites API endpoints, you will need to sign up for a free account on the Divesites API homepage. Once you've signed up, you will receive an API key which you will need to include in all API requests.

Endpoints

The Divesites API offers several endpoints to access data related to dive sites. The following endpoints are available:

  • GET /sites - Returns a list of all dive sites in the API.
  • GET /sites/{id} - Returns information on a single dive site.
  • GET /sites/search - Allows you to search for dive sites based on various search criteria.

Examples

To use the Divesites API, you will need to make HTTP requests to the API endpoints using JavaScript. Here are some examples of how to do this using different JavaScript libraries:

Fetch API

const apiKey = 'YOUR_API_KEY';
const endpoint = 'http://api.divesites.com/sites';

fetch(`${endpoint}?apiKey=${apiKey}`)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

jQuery

const apiKey = 'YOUR_API_KEY';
const endpoint = 'http://api.divesites.com/sites';

$.ajax({
  url: `${endpoint}?apiKey=${apiKey}`,
  method: 'GET',
  success: data => console.log(data),
  error: error => console.error(error)
});

Axios

const apiKey = 'YOUR_API_KEY';
const endpoint = 'http://api.divesites.com/sites';

axios.get(`${endpoint}?apiKey=${apiKey}`)
  .then(response => console.log(response.data))
  .catch(error => console.error(error));

Conclusion

The Divesites API is a powerful tool that provides easy access to information on thousands of dive sites worldwide. In this article, we've covered how to use the API using JavaScript. With just a few lines of code, you can start using the API to create your own dive site applications or add dive site information to existing applications. Happy diving!

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 7Jun 9Jun 11Jun 13Jun 15Jun 17Jun 19Jun 21Jun 23Jun 25Jun 27Jun 29Jul 1Jul 3Jul 604008001440Minutes
Online
Offline

Related APIs in Sports & Fitness