MuleSoft announces solutions to build a future-ready foundation for AI.
Skip to main content
Contact Us 1-800-596-4880

This is the first part of our series What Are APIs and How Do They Work?. If you missed the introduction to this series -- APIs Are Like User Interfaces--Just With Different Users In Mind -- we strongly suggest you start there first. In this second part of our series, we will define the million dollar question "What is an API?"

Another way of thinking about APIs is in the context of a wall socket. In North America and other parts of the world, the electrical sockets found in the walls of homes and businesses are essentially interfaces to a service: the electricity that’s consumed by everything from our computers and smartphones to appliances like vacuum cleaners and hair dryers. In other words, it’s important to think of the electricity as a service and of each device that uses electricity as a consumer of that service. In this scenario, instead of having its own source of power (the way a car does), the consumer is outsourcing its power requirements to the provider of a service.

While they may differ depending on where they are in the world, electrical sockets have predictable patterns of openings into which electrical plugs that match those patterns fit. The service itself also conforms to certain specifications. For example, in North America, most wall sockets deliver 120 volts of alternating current (AC) operating at 60Hz (the frequency at which the current alternates directions). This specification essentially sets an expectation on behalf of consuming devices. For example, your microwave oven has an expectation of the wall socket that it's plugged-into and the wall-socket has an expectation of the microwave oven. Likewise, an API specifies how software components should interact with each other.

So, what, if anything do electric wall sockets have to do with APIs? Well, among the many metaphors that could be used to help visualize how APIs work, the wall socket comes pretty darn close and in the next part of the series, we'll explain why.

This is a part of our series What Are APIs and How Do They Work? In the next part (part 2), we’ll use the metaphor of the electric wall socket to explain some of the key benefits of APIs.