10. Incorporating Schemas Into Your Project

Dave Wexler edited this page Jan 11, 2017 · 1 revision

What is a schema?

At its most basic level, a schema is a prototypical outline that describes a pattern of information. Wikipedia, in fact, defines it as “shape, or more generally, plan.” In this regard, a defined schema can apply to any number of items that fit its pattern, whether at a high level of abstraction or a lower level that might get more specific with its definitions. In our case, schemas identify common patterns among a group of API services.

For example, a “Place” schema might consist of a place’s name, latitude and longitude.

Because of this categorization, you know that anything that fits the Place schema will possess these characteristics.

Why should you care about schemas?

In the world of APIs, data generally does not follow one universal standard. As such, data from multiple sources often can’t be combined easily because they may use different naming conventions, different standards of data structures or types, or different levels of specificity. With that in mind, how can you ensure that the data you want is the data you get? How can you be sure that when searching for airports the name, latitude, longitude and the IATA code are formatted in the way that makes the most sense for you?

That’s where generic schemas can help you. When you select information that belongs to a schema, you will have access to other endpoints that also fit this schema, allowing you to select the form of this data that works best for your needs. By doing so you can increase the integrity and quality of the data you’re gathering, ensuring a higher level of uniformity and usability.

An example of such a union would be to consider a list of airports in America. Say that one API returns all public airports in the US, while another returns all military airports. By combining these APIs via the schema, you can effectively create a dataset consisting of all public and military airports in the US.