When you go through Wikipedia definition of API and API Testing, you might find a long description but in simple terms they are like a waiter in a restaurant who serves your request. Taking request from the customer and passing this information to the data center (here the kitchen) and acknowledging the request and bringing the data (food here).
So, if that’s the case with various codes trying to interact with each other, how will the website know that you want to request something from it? You will need an API.
Now there are many types of APIs that you might come across in your daily world. Every API has a different role, with a varied set of underlying working protocols, and unique execution methods for different environments.
Remember the Trivago Guy?? Aggregator websites like Trivago bring you offer prices of various hotels from multiple sources like Expedia, Hotels.com, Goibibo etc, all in a single platform. A user can book a hotel and avail an offer rolled out by Expedia, without even logging into Expedia!!.
So, how this happens? The simple answer to your mind scratching question turns out to be API.
So, with the help of API your application can communicate with third party application without any human intervention, acting as a communication bridge in other words.
Verifying that all the API endpoints act as expected without any breaks in between is the main aim behind API Testing.