Skip to content

darwinphi/philippine-addresses-graphql

Repository files navigation

Philippine Addresses GraphQL API

Access data based on regions, provinces, cities and barangays in the Philippines. Check the full schema here.

📦 Installation

In local development

git clone [email protected]:darwinphi/philippine-addresses-graphql.git

Install dependecies...

npm install

...then open http:https://localhost:4000/graphql

🔧 Usage

Using curl

curl  --location --request POST 'https://ph-addresses-api.vercel.app/graphql' \
      --header 'Content-Type: application/json' \
      --data '{"query": "query { regions { regionName } }"}'

Queries

All Regions
regions {
  regionName
  ...
}
All Provinces
provinces {
  provinceName
  ...
}
All Cities
cities {
  cityName
  ...
}
All Barangays
barangays {
  brgyName
  ...
}
Get Provinces by Region
provinceByRegion(regionCode: String!) {
  provinceName
  ...
}
Get Cities by Province
citiesByProvince(provinceCode: String!) {
  cityName
  ...
}
Get Barangays by City
barangasByCity(cityCode: String!) {
  cityName
  ...
}
Get All Addresses by Region
addresses(regionCode: String!) {
  provinces {
    provinceName
  }
  cities {
    cityName
  }
  barangays {
    brgyName
  }
}
addresses(regionCode: String!) {
  provinces {
    provinceName
  }
}
addresses(regionCode: String!) {
  cities {
    cityName
  }
}
addresses(regionCode: String!) {
  barangays {
    brgyName
  }
}

Data Source

Philippine Statistics Authority

License

This project is under MIT License