what is the use of API code example
Example 1: what is an api
An application program interface (API) is a set of routines, protocols, and
tools for building software applications.
Basically, an API specifies how software components should interact.
Additionally, APIs are used when programming graphical user interface (GUI)
components.
A good API makes it easier to develop a program by providing all the
building blocks. A programmer then puts the blocks together.
Example 2: what is an api
=> On a bare minimum explanation, API are function prototypes which enable the
user to use the functionality of any component by making a function call
without revealing the internal workings of the component.
=> It is a mode of abstraction from the lower layers of software stack , so as
to only provide service when needed for higher layers.
=> An API can manifest in many forms, it can be a simple function call in C,
it can be web service API such as Twitter or FB API, it can be a library call
to OS kernel, or can be an interrupt routine.
=> API can be just a standalone call or in form of libraries. API are part
and parcel of software interaction and data transfer.
Hope this clarifies.
Example 3: purpose of api
Knowing the purpose of the API will
set a firm foundation for you to
well prepare your test data for input
and output. This step also helps you
define the verification approach.
For example, for some APIs, you will
verify the responses against the
database; and for some others, it is
better to verify the responses
against other APIs.