http://www.technicalpage.net/search/label/SQL

API Testing

There are two types of Web/API services:
SOAP
REST


Tools: Soap UI, Postman, Jmeter

 

Rest API: YouTube link: Test Rest API : GET, POST, PUT, DELETE in Postman

HTTP Requests in API testing, there are four main requests in API testing:
Get: Read the data
Post: Create the data.
Put: Update the data. This will update the entire data set such as updating an entire row of a database table. If the resource is not present then it will create the resource.
Delete: Delete the data

Patch: Update partial data. Such as a field in a row.


Response Codes in the API testing:

Some frequently seen and crucial "API Status Codes":

 

200-299       This is to show the success status:

200             OK: Mostly Get and Put requests and sometimes Post request   return this status.

201              Created: The request was successful and the new resource has been     created(such as adding data in the database) as per the request. Mostly Post request and sometimes Put request returns this code.

204             No Content: The requested job/task is done but there is no response to return for the request. For example, Delete request.

400-499      Error on the client side

400              Bad Request: there is problem in the request, Server could not understand the request maybe due to syntax error.

401              UnAuthorized: This code is displayed when authentication is required. Such as if the wrong credentials are entered in the API request or the credentials are not entered or entered wrong token, where they are needed.

403             Forbidden: This is unauthorized request. The client does not have authorization to access the requested resource. Unlike 401, the server knows the client’s identification but he is not authorized to access the resource or content.

404             Not Found: This response code is returned if the requested resource is not found or does not exist. Example: when you make spelling mistake in the URL or when you give Post instead of Get.

408             Request Timeout: When the server is waiting for the client to complete the request and the client is taking too long to send the full request after the server has sent a request for more data. That means, the server could not get the complete request in time.

415             Unsupported Media Type:  When the media type of the request payload is not supported by the server and refuses to process the request. For example: if a server only accepts JSON data but the client sends XML or HTML data, the server will respond with a 415 status code.

500-599      Error on Server side

500             Internal Server Error: The server can not work on the request or fulfill the request because of some error. The server is unable to handle the request.

502             Bad Gateway: The server got invalid response when working as a gateway to manage the request.

504             Gateway Timeout: The server did not get the response in time when working as a gateway.

 

100-199        Informational response such as request has been received, processing the request etc.

 

300-399       Redirection messages such as the URL for the requested resource has been changed permanently or temporarily, maybe there are more than one possible response and tells user to choose one of them and so on.

 

 

 

































 
















                                                   




























    


















No comments:

Post a Comment