GeographQL

GeographQL

Geocoding

A Country, State, and City GraphQL API

Visit API

📚 Documentation & Examples

Everything you need to integrate with GeographQL

🚀 Quick Start Examples

GeographQL Javascript Examplejavascript
// GeographQL API Example
const response = await fetch('https://geographql.netlify.app', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

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

The Country, State, and City GraphQL API is a powerful tool designed to facilitate geographic data retrieval with ease and efficiency. This API allows developers to query detailed information about countries, states, and cities using a single, flexible endpoint. With GraphQL, you can structure your requests to receive only the data you need, reducing payload size and improving application performance. Whether you are building a global application, a location-based service, or simply need to enrich your dataset with geographic information, this API streamlines the process and enhances user experience.

Using the Country, State, and City GraphQL API comes with multiple advantages. It simplifies data fetching, provides a comprehensive and up-to-date database, and allows for intuitive querying that adapts to various use cases. Additionally, it supports efficient filtering and sorting of data, making it perfect for applications that require accuracy and speed. Here are some key benefits of utilizing this API:

  • Access to a structured database of countries, states, and cities.
  • Flexible querying capabilities with GraphQL for tailored responses.
  • Reduced data transfer size by fetching only the necessary fields.
  • Up-to-date geographic information reflecting real-world accuracy.
  • Seamless integration with modern web applications and frameworks.

Below is a JavaScript code example that demonstrates how to call the Country, State, and City GraphQL API to retrieve a list of states within a specific country:

const fetch = require('node-fetch');

const query = `
{
  country(code: "US") {
    name
    states {
      code
      name
    }
  }
}
`;

fetch('https://geographql.netlify.app/.netlify/functions/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ query })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error fetching data:', error));

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

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

Related APIs in Geocoding