Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding REST: Architectural Style, Components, and Popular Representations, Cheat Sheet of Operating Systems

The concept of REST (Representational State Transfer), an architectural style for developing web services that utilizes HTTP protocol and standard methods to access resources. It covers the core components of an HTTP request, popular ways to represent resources, and common HTTP methods used in REST. Additionally, it introduces REST Assured, a library for testing REST APIs.

Typology: Cheat Sheet

2018/2019

Uploaded on 08/18/2021

adb-vlogs
adb-vlogs 🇮🇳

1 document

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
. Explain REST?
Ans.REST stands for Representational State Transfer. REST is an architectural style
of developing web services which take advantage of the ubiquity of HTTP protocol and
leverages HTTP method to define actions. It revolves around resource where every
component is a resource which can be accessed by a common interface using HTTP
standard methods.
In REST architecture, a REST Server provides access to resources and REST client
accesses and presents those resources. Here each resource is identified by URIs or
global IDs. REST uses different ways to represent a resource like text, JSON, and
XML.XML and JSON are the most popular representations of resources these days.
What Is The Most Popular Way To Represent A Resource In
REST?
Ans.REST uses different representations to define a resource like text, JSON, and
XML.
JSON is the most popular representations of resources.
Explain What Is A “Resource” In REST?
Ans.REST architecture treats every content as a resource. These resources can be
either text files, HTML pages, images, videos or dynamic business data.
REST Server provides access to resources and REST client accesses and modifies
these resources. Here each resource is identified by URIs/ global IDs.
Which Protocol Is Used By RESTful Web Services?
Ans.RESTful web services make use of HTTP protocol as a medium of
communication between client and server.
pf3
pf4
pf5

Partial preview of the text

Download Understanding REST: Architectural Style, Components, and Popular Representations and more Cheat Sheet Operating Systems in PDF only on Docsity!

. Explain REST?

Ans. REST stands for Representational State Transfer. REST is an architectural style of developing web services which take advantage of the ubiquity of HTTP protocol and leverages HTTP method to define actions. It revolves around resource where every component is a resource which can be accessed by a common interface using HTTP standard methods. In REST architecture, a REST Server provides access to resources and REST client accesses and presents those resources. Here each resource is identified by URIs or global IDs. REST uses different ways to represent a resource like text, JSON, and XML.XML and JSON are the most popular representations of resources these days.

What Is The Most Popular Way To Represent A Resource In

REST?

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

Explain What Is A “Resource” In REST?

Ans. REST architecture treats every content as a resource. These resources can be either text files, HTML pages, images, videos or dynamic business data. REST Server provides access to resources and REST client accesses and modifies these resources. Here each resource is identified by URIs/ global IDs.

Which Protocol Is Used By RESTful Web Services?

Ans. RESTful web services make use of HTTP protocol as a medium of communication between client and server.

What Is Messaging In RESTful Web Services?

Ans. RESTful web services make use of HTTP protocol as a medium of communication between client and server. The client sends a message in the form of an HTTP Request. In response, the server transmits the HTTP Response. This technique is called Messaging. These messages contain message data and metadata i.e. information about the message itself.

State The Core Components Of An HTTP Request?

Ans. Each HTTP request includes five key elements.

1. The Verb which indicates HTTP methods such as GET, PUT, POST, DELETE. 2. URI stands for Uniform Resource Identifier (URI).It is the identifier for the resource on the server. 3. HTTP Version which indicates HTTP version, for example-HTTP v1.1. 4. Request Header carries metadata (as key-value pairs) for the HTTP Request message. Metadata could be a client (or browser) type, the format that client supports, message body format, and cache settings. 5. Request Body indicates the message content or resource representation.

What is Rest Assured?

In order to test REST APIs, I found REST Assured library so useful. It is developed by JayWay Company and it is a really powerful catalyzer for automated testing of REST- services. REST-assured provides a lot of nice features, such as DSL-like syntax , XPath-Validation , Specification Reuse , easy file uploads and with those features we will handle automated API testing much easier.

How to declare the API details in Rest Assured Test?

Using Given(), When(), Then()

when().

post("/greetXML").

then().

body("greeting.firstName", equalTo("John")).

body("greeting.lastName", equalTo("Doe"));

How to Insert cookies in Testing the API using Rest Assured? given().cookie("username", "John").when().get("/cookie").then().body(equalTo("username")); How to Insert headers in Testing the API using Rest Assured? given().header("MyHeader", "Something"). How to Validate Response Headers with Rest Assured? get("/x").then().assertThat().header("headerName", "headerValue"). How to handle Basic Authentication with Rest Assured? given().auth().preemptive().basic("username", "password").when().get("/secured/hello").then().statusCode( 200 );

What Do You Understand By Payload In RESTFul Web Service?

Ans. Request body of every HTTP message includes request data called as Payload. This part of the message is of interest to the recipient. We can say that we send the payload in POST method but not in and methods.