An application programming interface (API) is an interface for a computer program to interact with another. Oftentimes websites and databases have APIs that our programs must interact with. APIs abstract details for programmers, i.e., it specifies the arguments and return values.

In our code

We should have API getters and setters functions in our code instead of interacting with it directly in our code. This is because it abstracts away the implementation to a set of functions. If the APIs change over time, we know all we need to do is change the getters and setters, and modify the API output/input data structure processing to our code as necessary.1

See also

Footnotes

  1. From this article by Chris Ferdinandi at Go Make Things.