This post is a continuation of Top 30 API Testing Interview Questions and Answers – Part 1 for any QA Automation interview. 

16.  What is an HTTP response?

When you issue an HTTP Request to the server you receive an HTTP Response. The response from the server tells you if your request was successful, or if there was a problem.

Response contains:

status code of 200, which means that the request was successful.

content-Type header of application/JSON means that the body is a JSON response

body that contains the actual payload response from the server.

_____________________________________________________________________

17. What is an HTTP status code?

Web Services and HTTP APIs use HTTP Status Codes to tell us what happened when the server processed the request.

The simple grouping for HTTP Status Codes is:

1xx – Informational

2xx – Success e.g. 200 Success

3xx – Redirection e.g. 302 Temporary Redirect

4xx – Client Error e.g. 400 Bad Request, 404 Not Found

5xx – Server Error e.g. 500 Internal Server Error

The type of status code you receive depends on the application you are interacting with. Usually, a 4xx error means that you have done something wrong and a 5xx error means that something has gone wrong with the application server you are interacting with.

_____________________________________________________________________

18.  What is RESTFul Web Services?

Web services developed in the REST style are referred to as RESTful web services. These web services use HTTP methods to implement the concept of REST architecture.

A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation like JSON and a set of HTTP methods.

_____________________________________________________________________

19. What is a “Resource” in REST?

REST architecture treats any content as a resource, which can be either text files, HTML pages, images, videos or dynamic business information.

_____________________________________________________________________

20. Can you tell us which Java API helps in developing a RESTFul web service?

In JAVA there are many frameworks and libraries available that a developer can use to create RESTful web services. For example, the JAX-RS library is a standard way to develop a REST web service.

Also, Jersey is another most popular implementation of JAX-RS which offers more than what the specs recommend. There are others like RESTEasy, RESTlet, and Apache CFX and Play framework to develop RESTful web services.

_____________________________________________________________________

21. what is postman and Explain 3-tier architecture?

Postman is one of the most widely used API testing tool now.

All web application comes under 3 tier architecture. It consists of three layers.

Client / Presentation-  It is the presentation layer from which the user sends the request. Like Browsers.

Business Logic- As soon as the user sends the request from the client layer corresponding business logic gets executed. Business logic will pass the request to the database layer and vice versa.

Database- As per the request from the business logic database provide the set of data.

Business Logic acts as a mediator between the client and database, it contains business logic written in programming language collectively known as API. Business Logic takes input from the client and sends back the output to the client after interacting with the database.

______________________________________________________________________

22. How we can add validation points in postman?

Once we will send a request we will get a response body and in the Test tab we can add the validation points like:

1- Validating the Status Code:

tests[“Validating Status Code”] = responseCode.code == 200;

2- Next validating data in the response body:

tests[“Validating response body”] = responseBody.has(“data”);

3- Validating data in speficic field in the response body:

var response = JSON.parse(responseBody);

tests[“page no”] = response.page == 2;

We have added 3 validation, even one validation failed the entire test will fail.

______________________________________________________________________

23. What is the difference between the path parameter and query parameter?

query parameter will filter the data.

Example: https://reqres.in/api/users?page=2

path parameter will simply get the data based on the path we specify.

Example: https://reqres.in/api/users/2

______________________________________________________________________

24. Define in detail about REST?

REST stands for REpresentational State Transfer. REST is a web standards-based architecture and uses HTTP Protocol for data communication. It revolves around resources where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. REST was first introduced by Roy Fielding in 2000.

In REST architecture, a REST Server simply provides access to resources, and a REST client accesses and presents the resources.

Here each resource is identified by URIs/ global IDs. REST uses various representations to represent a resource like text, JSON, and XML.

Nowadays JSON is the most popular format being used in web services.

Following well-known HTTP methods are commonly used in REST-based architecture:

GET − Provides read-only access to a resource.

PUT − Used to create a new resource.

DELETE − Used to remove a resource.

POST − Used to update an existing resource or create a new resource.

OPTIONS − Used to get the supported operations on a resource.

______________________________________________________________________

25)Explain the RESTFul Web Service?

Mostly, there are two kinds of Web Services which are quite popular.

1. SOAP (Simple Object Access Protocol) which is an XML-based way to expose web services.

2. Web services developed using REST style are known as RESTful web services. These web services use HTTP methods to implement the concept of REST architecture.

A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation such as JSON and set of HTTP Methods.

______________________________________________________________________

26. What is the most popular way to represent a resource in REST?

REST uses different representations to define a resource like text, JSON, and XML.
XML and JSON are the most popular representations of resources.

______________________________________________________________________

27. What are SOAP Web services and how does it work?

The SOAP (Simple Object Access Protocol) is defined as an XML-based protocol. It is known for designing and developing web services as well as enabling communication between applications developed on different platforms using various programming languages over the Internet. It is both platform and language independent

SOAP is used to provide a user interface that can be accessed by the client object, and the request that it sends goes to the server, which can be accessed using the server object. The user interface creates some files or methods consisting of server object and the name of the interface to the server object.

 It also contains other information such as the name of the interface and methods. It uses HTTP to send the XML to the server using the POST method, which analyzes the method and sends the result to the client.

The server creates more XML consisting of responses to the request of user interface using HTTP. The client can use any approach to send the XML, like the SMTP server or POP3 protocol to pass the messages or reply to queries.

Use the SOAP API to create, retrieve, update or delete records, like accounts, leads, and user-defined objects. With more than 20 different calls, you can also use the SOAP API to manage passwords, perform searches, etc. by using the SOAP API in any language that supports web services.

______________________________________________________________________

28. How users utilize the facilities provided by SOAP?

PutAddress(): It is used to enter an address in the webpage and has an address instance on the SOAP call.

PutListing(): It is used to allow the insertion of a complete XML document into the web page. It receives the XML file as an argument and transports the XML file to XML parser liaison, which reads it and inserts it into the SOAP call as a parameter.

GetAddress(): It is used to get a query name and gets the result that best matches a query. The name is sent to the SOAP call in the form of text character string.

GetAllListing(): It is used to return the full list in an XML format.

______________________________________________________________________

29. What is the major obstacle users faced when using SOAP?

When using SOAP, users often see the firewall security mechanism as the biggest obstacle. This block all the ports leaving few like HTTP port 80 and the HTTP port used by SOAP that bypasses the firewall.

The technical complaint against SOAP is that it mixes the specification for message transport with the specification for message structure.

______________________________________________________________________

30. What are the syntax rules for a SOAP message?

A) Must use encoded XML.

B) Envelope namespace must be used.

C) Encoding namespace must be used.

D) Must not consist of a DTD reference.

E) Must not have XML processing instruction.

______________________________________________________________________

Course Alert

If you are interested in learning API testing, check out some of the popular courses on Rest Assured, SoapUI, Python API testing below:

A Quick Note

Please remember all these courses comes with 100% Lifetime access and free updates for Lifetime!!


Tags


You may also like

Groups attribute in TestNG 

Groups attribute in TestNG 
Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}