types of apis code example
Example 1: types of method in api
GET is used for reading and retrieving data.
POST is used for inserting data.
PUT is used for updating data.
DELETE is used for deleting data.
The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively.
Example 2: 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.