1

I'm looking for an api that says the available counties for each states.... Like for Nebraska, it should return Douglas, Sarpy, Fremont, etc...

Any answer would be appreciated.

2 Answers 2

0

Even I do not have API, but these two resources can help a lot.

  1. NACo County Explorer which is interactive map based county explorer which gives information like population, area, economy, county contact. On profile, you can select different maps based on different parameters.

  2. List of counties by U.S. state and territory , it is Wikipedia page which contains list of counties by USA State.

0

back4app

This is a very detailed database with data about all the counties in the USA. The USA counties database is accessible via API and developers can perform queries and consume the data using the API playground.

The list of US counties dataset provides the following information for each county of the US

  • County Name
  • County State
  • County State Code
  • County MSA Code
  • County FIPS Code
  • County Township Code

Example with node.js

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

(async () => {
  const response = await fetch(
    'https://parseapi.back4app.com/classes/Area?limit=50&order=state,countyName&keys=countyName,state',
    {
      headers: {
        'X-Parse-Application-Id': 'VWAH9UbFty9tuCJVHIJPjYvH8OGcNyUTMkHH3UvL', // This is the fake app's application id
        'X-Parse-Master-Key': 'UsYwiuputxOcEcYTZqWKshopMgEjElqA4U4Mcy9V', // This is the fake app's readonly master key
      }
    }
  );
  const data = await response.json(); // Here you have the data that you need
  console.log(JSON.stringify(data, null, 2));
})();

Would give the following result:

{
  "results": [
    {
      "objectId": "rEqDvFeLMA",
      "state": "Alabama",
      "countyName": "Autauga County",
      "createdAt": "2019-12-17T15:23:19.860Z",
      "updatedAt": "2019-12-17T15:23:19.860Z"
    },
    {
      "objectId": "NNYekTy0dA",
      "state": "Alabama",
      "countyName": "Baldwin County",
      "createdAt": "2019-12-17T15:23:19.860Z",
      "updatedAt": "2019-12-17T15:23:19.860Z"
    },
    ...

Is API the way to go?

  • Is there a reason you have to use an API?
  • As Shivam has answered already you can find the information to download
  • As an example could you not add this file to your project -> JSON on github
  • This file is only 19KB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.