No-Code API Stacks: United States Census Bureau API Example

APIs are the corner piece of an application, specifically the data that can be accessed through the API. The United States Census Bureau provides a wealth of demographic information that can be accessed through its API. Apps developer, not to mention code-free marketing and diversity professionals use the census bureau API to find marketing and diversity data quickly. The census database contains demographic data on every city, county and state in the United States. With it for example, you can find the ethnicity, age and gender population breakdown of any city or state. With that data, numerous diversity and marketing reports, tables and charts can be produced. not to mention an innumerable number of apps can be created.

The No Code API Stack
If one looks at the tools and code that can be used to access an API, one can become overwhelmed very quickly. However, one does not need those tools and coding skills to access an API’s data. One simply needs to know how to construct an API query and paste it in a browser URL bar. For the most part, that will let you to search an API’s database and return the contents in a text file. Once done, that text file can be placed in, for example, an Excel spreadsheet. From within the Excel spreadsheet, Excel’s graphing, charting, business analytics and statistics functions can be accessed to produce any type of report, table or chart using the data found in the API.

In fact, one can build an app based on Excel that allows access innumerable APIs without any code at all. On the other hand, apps that are built with server and client side programming languages can offer functionality and flexibility that can be problematic to implement in a spreadsheet. One of the main reasons is that spreadsheets are not precisely databases, even though they do have rows and columns (or records and fields if your prefer). A database query can be easily produced that will search for an item in a field in all the database records and then sort the found results alphabetically. Its a little bit more difficult to do that in a spreadsheet, but it can be done.

No-Code API Access and Retrieve Example
For this example the United States Census Bureau’s census data will be accessed and placed in a text file. Although it is a simple and quick task, one will find as they use the census API, that the real work is in getting familiar with the associated data fields that are in its API.

Problem One: Find the Hispanic population of every state in the United States

Solution One: Type in your browser bar the following API query (it does not require a security key). Alternately you can just click on the link.

https://api.census.gov/data/2019/pep/charagegroups?get=NAME,POP&HISP=2&for=state:*

The partial results are shown in the screenshot below. Notice that the API query is in the URL browser bar. What is important to note about the query is that it contains a get statement followed by several variables. Get is the universal REST command used to retrieve data from an API. The variables that follow the get command, which the census bureau defines, are they key to searching the census data. POP stands for population and HISP for Hispanic. The for=state search statement is used to restrict the search to a specific field. Interpretation of the API query as an English sentences would be find the population of Hispanics in every state.

Query and Results from the United States Census Bureau API

The resultant listing above, lists the field names at the top that correspond to what was requested in the query. The first field the name of the state, the second is the population, the third is a coded number, 2, that indicates that the population in the population field is the Hispanic population. The fourth field which is named “state” is somewhat nebulas, but it appears to be a state code number.

The Next Step
As you can see, it is fairly straight forward to retrieve data through the census API. The art of it though is knowing how to construct a query, what the codes in the result stand for, and finally, becoming very familiar with the different census databases and the fields (variables) they contain, specifically what type of data that is contained in each field.

You can also import the Hispanic data found above into an Excel spreadsheet. In Excel you can run a statistical analysis or make a pie chart of Hispanic population by state. Today’s AI marketing and diversity apps require not only lots of data but an intelligent statistics algorithm based on statistics equations and normalized distributions (as illustrated in the StatisticsMatrix shown below.).

AI marketing apps are based on statistics algorithms and population census data

Citations
Example API Queries, The United States Census Bureau, Accessed February 7th, 2023
URL: https://www.census.gov/data/developers/guidance/api-user-guide/example-api-queries.html