From the course: Java: Automated API Testing with REST Assured
Anatomy of a request - Java Tutorial
From the course: Java: Automated API Testing with REST Assured
Anatomy of a request
- [Instructor] The communication between APIs, consists of two parts, a request, and a response. In this chapter we'll focus on the API request. Before we dive in too deep, let's discuss the anatomy of an API request to ensure we have a common vocabulary for these concepts. An API request is essentially comprised of four components. The endpoint is a URL. This is where our request is sent for processing. In this example, our endpoint is the update category functionality of the application. As you can see, this alone is not enough to determine what exactly our request is. Because the application does not know what it is we'd like updated. Which is why the additional pieces of the requests are needed. Such as the method. Which indicates the type of action we would like to take. And the headers, which specify any authorization credentials that may be required to make the request as well as other pertinent information. Such as, the format of how we like to receive our response. And last but not least, the data. This is an optional part of the requests that can be provided if there is additional information the API will need in order to fulfill our request. So, if we're making a request to delete a product, we need to specify which product we'd like deleted. The approach to providing this data varies. It can be provided via query parameters, or via a body. Also sometimes referred to as a payload.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Anatomy of a request1m 47s
-
(Locked)
Request methods1m 47s
-
Making a GET request9m 48s
-
(Locked)
Making a POST request4m 16s
-
(Locked)
Making a PUT request3m 7s
-
(Locked)
Making a DELETE request1m 52s
-
(Locked)
Serializing request body7m 26s
-
(Locked)
Challenge: Use requests to complete the lifecycle of a resource42s
-
(Locked)
Solution: Use requests to complete the lifecycle of a resource2m 32s
-
-