Rest Assured Interview QuestionSet1 PDF
Rest Assured Interview QuestionSet1 PDF
• This implementation is based on the Builder pattern, which allows you to easily construct an
HTTP request by chaining method calls.
Explanation:
4. What is REST?:
• REST stands for Representational State Transfer, which is an architectural style for designing
web services. It is a set of guidelines and constraints that define how web services should be
designed and operated.
• At its core, REST is based on a client-server model, where the client sends requests to the
server, and the server sends responses back to the client. These requests and responses are
typically sent over HTTP, using standard HTTP methods like GET, POST, PUT, and DELETE.
• When a client sends a GET request to a server, it is asking the server to return a representation
of the specified resource. The server will then search for the requested resource, and if found,
will send a response back to the client containing the requested data.
• When a client sends a POST request to a server, it includes a request body that contains the data
to be submitted. The server will then process the request body, and either create a new
resource or update an existing one, depending on the specific API.
• When a client sends a PUT request to a server, it includes a request body that contains the data
to be updated. The server will then process the request body, and update the specified resource
with the new data.
• When a client sends a DELETE request to a server, it includes a URL that specifies the resource to
be deleted. The server will then process the request and delete the specified resource.
• When a client sends a HEAD request to a server, the server will process the request and send
back a response that includes only the HTTP headers for the specified resource, without the
actual content of the resource.
• When a client sends an OPTIONS request to a server, the server will process the request and
send back a response that includes a list of HTTP methods that can be used to interact with the
resource, as well as other communication options.
RestAssured.baseURI = "http://example.com/api";
RestAssured.authentication = basic("username", "password");
System.out.println(response.getBody().asString());
• Remember:
• Basic authentication is not considered a very secure method of authentication, as the username
and password are transmitted in plaintext over the network, making them susceptible to
interception and eavesdropping.
• While the password is base64-encoded, it is not encrypted, and an attacker with access to the
network traffic can easily decode the password and gain access to the system.
• For this reason, it is generally recommended to use other more secure authentication
mechanisms, such as OAuth or JSON Web Tokens (JWT).