how to test rest endpoints code example

Example 1: how do you do positive api testing

How I do positive testing in api, 
	- I send valid path and query parameters, 
	- valid headers, 
	- valid request body to valid url and verify that 
	- response status code is correct and 
	- response body is as expected
    
How I do negative testing in api,
	- I send invalid request parameters
	- or invalid headers
	- or invalid request json body and verify 
    that response status code is not 200 
	- and response body contains error message 
    (for example there are 100 employees numbered
    from 1 to 100 I send 101 as a parameter and I
    should be able see 404 Not Found 
    The requested resource was not found.)

Example 2: why do you do rest api teting

The purpose of rest api testing is to record the response of rest api 
by sending various HTTP/S requests to check if rest api is working fine or not. 
Rest api testing is done by GET, POST, PUT and DELETE methods.

Rest stands for Representational State Transfer. It is an architectural style 
and an approach for communication used in the development of Web Services. 
REST has become a logical choice for building APIs. It enables users 
to connect and interact with cloud services efficiently.

Tags:

Misc Example