{"id":29860,"date":"2024-05-16T19:09:49","date_gmt":"2024-05-16T13:39:49","guid":{"rendered":"https:\/\/mobisoftinfotech.com\/resources\/?p=29860"},"modified":"2025-12-30T17:39:00","modified_gmt":"2025-12-30T12:09:00","slug":"api-automation-testing-headers-cookies-parameters-rest-assured","status":"publish","type":"post","link":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured","title":{"rendered":"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured"},"content":{"rendered":"<p>In API automation testing, ensuring proper handling of headers, cookies, and parameters is essential for accurately simulating real-world API interactions. These elements carry crucial information between the client and the server, influencing the behavior and outcome of API requests and responses. Rest Assured provides convenient methods for setting headers, adding cookies, and specifying various types of parameters. API automation allows the execution of a large number of test cases in a short amount of time, reducing the overall testing cycle.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Headers:<\/strong><\/h2>\n\n\n\n<p>Headers are a part of the HTTP request that contains additional information about the request. They are small pieces of information carrying significant weight in determining how data is transmitted, processed, and secured across the web. Headers are key-value pairs, where the key is a string that describes the type of information being provided, and the value is the actual data being provided.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Components of Headers:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Content-Type:<\/strong> Specifies the format of the data (request body) being sent or received, such as JSON, XML, or plaintext.<\/li>\n\n\n\n<li><strong>Authorization:<\/strong> Contains authentication credentials or tokens, ensuring secure access to protected resources.<\/li>\n\n\n\n<li><strong>Accept:<\/strong> Indicates the preferred content type expected in the response. For example, the value of &#8220;application\/json&#8221; indicates that the client prefers a response in JSON format.<\/li>\n\n\n\n<li><strong>User-Agent:<\/strong> Identifies the client making the request and software version.<\/li>\n\n\n\n<li><strong>Cache-Control: <\/strong>Controls caching behavior. It indicates whether responses can be cached and for how long. For example, a value of &#8220;no-cache&#8221; indicates that the response should not be cached.<\/li>\n\n\n\n<li>Please refer to the image below to define headers in Rest Assured.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"177\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/header-declaration.png\" alt=\"Rest Assured Header Declaration\" class=\"wp-image-29891\" title=\"Header Declaration in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"177\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20177%22%3E%3C%2Fsvg%3E\" alt=\"Rest Assured Header Declaration\" class=\"wp-image-29891 lazyload\" title=\"Header Declaration in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/header-declaration.png\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Cookies:<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Cookies are small pieces of data stored on the client&#8217;s side by the web server. They are used to maintain user session state, track user behavior, and store user preferences. Cookies are sent by the client to the server with every subsequent request, allowing the server to identify and personalize the user experience.<\/span><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><b>Importance of Cookies in API Testing:<\/b><\/h4>\n\n\n\n<ul class=\"new-li-design\">\n<li>1. <b>Authentication and Authorization:<\/b> Many APIs require authentication to access protected resources. Cookies often play a role in this process, as they may contain session tokens or authentication credentials. Verifying that authentication cookies are correctly handled is crucial for testing access control mechanisms.<\/li>\n<li>2. <b>Session Management:<\/b> Testing how cookies are created, managed, and invalidated throughout the session ensures that the API behaves as expected, maintaining session consistency and security.\n<\/li>\n<li>3. <b>Cookie-Based Flows:<\/b> Some APIs employ cookie-based workflows, where certain actions or operations are triggered based on the presence or absence of specific cookies. Testing these workflows involves sending requests with appropriate cookies and verifying the API&#8217;s response and behavior.\n<\/li>\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/mobisoftinfotech.com\/services\/test-automation?utm_source=blog_cta&#038;utm_campaign=cart-aapi-automation-testing-headers-cookies-parameters-rest-assured-cta1\"><noscript><img decoding=\"async\" width=\"855\" height=\"150\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/automation-testing-services.png\" alt=\"Automation Testing Services\" class=\"wp-image-29883\" title=\"Explore Our Tailored Automation Solutions\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"150\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20150%22%3E%3C%2Fsvg%3E\" alt=\"Automation Testing Services\" class=\"wp-image-29883 lazyload\" title=\"Explore Our Tailored Automation Solutions\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/automation-testing-services.png\"><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Parameters:<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Parameters are additional details included in the URL along with the request.<\/span><\/p>\n\n\n\n<p><b>Types of Parameters:<\/b><\/p>\n\n\n\n<ul class=\"new-li-design\">\n<li>1. <b>Path Parameters:<\/b> Path parameters in REST APIs are placeholders in the URL that are replaced with actual values when making requests. They are commonly used to specify unique identifiers or resource names within the URL path. \nPath parameters are sent in the URL using curly braces {}.\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"291\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/path-parameter-declarations.png\" alt=\"Path Parameter Declarations in Rest Assured\" class=\"wp-image-29863\" title=\"Path Parameters in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"291\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20291%22%3E%3C%2Fsvg%3E\" alt=\"Path Parameter Declarations in Rest Assured\" class=\"wp-image-29863 lazyload\" title=\"Path Parameters in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/path-parameter-declarations.png\"><\/figure>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<p>Retrieve the details of the employee whose id is \u201c123\u201d.<\/p>\n\n\n\n<p><strong>\u201capi\/employees\/{id}\u201d<\/strong><\/p>\n\n\n\n<p>Here {Id} is a path parameter.&nbsp;<\/p>\n\n\n\n<p><strong>Example: To fetch details of employee id 123, the request will be: \u201capi\/employees\/123\u201d<\/strong><\/p>\n\n\n\n<ul class=\"new-li-design\">\n<li>2. <b>Query Parameters:<\/b>\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<p><span style=\"font-weight: 400;\">Query parameters appear after the question mark symbol \u2018?\u2019 in the URL.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">These parameters help to get specific data from the API.<\/span><\/p>\n\n\n\n<p><b>Example 1:<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Retrieve a list of employees whose designation is QA Engineer.<\/span><\/p>\n\n\n\n<p><b>\/employee?designation=qa<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">In the above example, <\/span><b>?designation=qa<\/b><span style=\"font-weight: 400;\"> is the query parameters.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The question mark denotes the start of a query parameter. There can be multiple query parameters in the URL. It can be achieved by separating parameters through an &#8216;&amp;&#8217; sign.<\/span><\/p>\n\n\n\n<p><b>Example 2:<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Retrieve a list of employees whose designation is QA Engineer and experience is 3 years.<\/span><\/p>\n\n\n\n<p><b>\/ employee?designation=qa&amp;exp=3<\/b><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><b>Uses of Query Parameters:<\/b><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Filtering:<\/b><span style=\"font-weight: 400;\"> Query parameters can be used to filter data on specific criteria. <\/span><b>Example:<\/b><span style=\"font-weight: 400;\"> While shopping online, the user needs shoes in a certain color or within a specific price range.<\/span><\/li>\n\n\n\n<li><b>Pagination:<\/b><span style=\"font-weight: 400;\"> APIs often return large collections of data, such as lists of users, posts, or products. Pagination query parameters enable clients to navigate through these collections by specifying the page number and the number of items per page.<\/span><\/li>\n<\/ul>\n\n\n\n<p><b>Example:<\/b><span style=\"font-weight: 400;\"> Query parameters help you navigate to the pages by telling the API which page of results you want to see and how many items to show per page.<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Searching:<\/b><span style=\"font-weight: 400;\"> Query parameters are used for search functionality, allowing users to retrieve resources matching certain search terms or criteria. <\/span><b>Example: <\/b><span style=\"font-weight: 400;\">The user search terms in Google. You can tell the API what you&#8217;re searching for, and it&#8217;ll give you back relevant results.<\/span><\/li>\n\n\n\n<li><b>Sorting: <\/b><span style=\"font-weight: 400;\">Query parameters can be used to sort the data returned by the API based on specific criteria. <\/span><b>Example: <\/b><span style=\"font-weight: 400;\">If a user is browsing a list of products on an ecommerce site,Query parameters allow you to sort products by price, rating, or any other criteria you choose.<\/span><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Project Configuration:<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">In this project, we are using TestNG 7.10.0, Selenium 4.20.0, Rest Assured 4.4.0, and Maven archetype 4.0.0. TestNG is used as a test runner as it helps in running the test scripts.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 1: Set Up Your Environment<\/b><\/h3>\n\n\n\n<ul class=\"new-li-design\">\n<li>1. <b>Install Java Development Kit (JDK):<\/b> Download and install the latest JDK from the official Oracle website.<\/li>\n<li>2. <b>Set Up IDE:<\/b> Choose an Integrated Development Environment (IDE) like IntelliJ IDEA or Eclipse.\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 2: Create a New Maven Project<\/b><\/h3>\n\n\n\n<ul class=\"new-li-design\">\n<li>1. 1. In Eclipse, Go to <b>File -&gt; New -&gt; Project<\/b>.\n<\/li>\n<li>2. Select <b>Maven -&gt; Maven Project<\/b> and click <b>Next<\/b>.\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 3: Select Maven Archetype:<\/b><\/h3>\n\n\n\n<ul class=\"new-li-design\">\n<li>a. Choose <b>org.apache.maven.archetypes:maven-archetype-quickstart<\/b> and click <b>Next<\/b>.\n<\/li>\n<li>b.  Configure Maven Project:\n<ul>\n<li>i. Fill in the required fields such as Group Id and Artifact Id.<\/li>\n<li>ii. Optionally, you can provide a version and a package name.<\/li>\n<li>iii. Click Finish.<\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 4: Configure Selenium WebDriver Dependency:<\/b><\/h3>\n\n\n\n<ul class=\"new-li-design\">\n<li>1. Once the Maven project is created, open the <b>pom.xml<\/b> file..\n<\/li>\n<li>2. Add the Selenium WebDriver and TestNG dependency within the <dependencies> section:(Please refer the image given below)\n<\/dependencies><\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"856\" height=\"557\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/maven-dependencies.png\" alt=\"Maven Dependencies for Rest Assured\" class=\"wp-image-29876\" title=\"Maven Dependencies in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"856\" height=\"557\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20856%20557%22%3E%3C%2Fsvg%3E\" alt=\"Maven Dependencies for Rest Assured\" class=\"wp-image-29876 lazyload\" title=\"Maven Dependencies in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/maven-dependencies.png\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 5: Create Test Class to test query parameters<\/b><\/h3>\n\n\n\n<ul class=\"new-li-design\">\n<li>1.Create a new Java class under src\/test\/java. \nRight click on Package name \u2192 new \u2192 Class (Refer below image)\n<\/li>\n\n<\/ul>\n<style>\nul.new-li-design li:before {\n    display: none;\n}\n<\/style>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"814\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/java-class-creation.png\" alt=\"Creating Java Class for Rest Assured Test\" class=\"wp-image-29867\" title=\"Java Class Creation for Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"814\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20814%22%3E%3C%2Fsvg%3E\" alt=\"Creating Java Class for Rest Assured Test\" class=\"wp-image-29867 lazyload\" title=\"Java Class Creation for Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/java-class-creation.png\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">The code below <\/span><span style=\"font-weight: 400;\">utilizes the RestAssured library to test an API with query parameters.<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">Here, <\/span><b>page=2<\/b><span style=\"font-weight: 400;\"> is a query parameter. This api will fetch the details of users in responses from page no 2. <\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"770\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/query-parameter-test-case-1.png\" alt class=\"wp-image-29893\" title=\"Test Case for Query Parameters in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"770\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20770%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-29893 lazyload\" title=\"Test Case for Query Parameters in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/query-parameter-test-case-1.png\"><\/figure>\n\n\n\n<p><b>The image below contains the response&nbsp; where we can see the query parameter has been passed through the URL.<\/b><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"630\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/query-parameter-test-response.png\" alt=\"Response of Query Parameter Test in Rest Assured\" class=\"wp-image-29869\" title=\"Query Parameter Test Response in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"630\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20630%22%3E%3C%2Fsvg%3E\" alt=\"Response of Query Parameter Test in Rest Assured\" class=\"wp-image-29869 lazyload\" title=\"Query Parameter Test Response in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/query-parameter-test-response.png\"><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>public class QueryParameterTest():<\/b><span style=\"font-weight: 400;\"> It declares a Java class name.<\/span><\/li>\n\n\n\n<li><b>@Test:<\/b><span style=\"font-weight: 400;\"> This annotation denotes that the following method is a test case to be executed by the testing framework (Here,TestNG framework has been used).<\/span><\/li>\n\n\n\n<li><b>public void verifyQueryParameters() <\/b><span style=\"font-weight: 400;\">: This method contains the actual test logic. It&#8217;s named verifyQueryParameters().<\/span><\/li>\n\n\n\n<li><b>SoftAssert softAssert = new SoftAssert(): <\/b><span style=\"font-weight: 400;\">This creates an instance of SoftAssert. Soft assertions allow the test to continue running even if one or more assertions fail.<\/span><\/li>\n\n\n\n<li><b>String baseUrl =&#8221;https:\/\/gorest.co.in&#8221;: <\/b><span style=\"font-weight: 400;\">This variable holds the base URL of the API.<\/span><\/li>\n\n\n\n<li><b>String endpoint<\/b> <b>= &#8220;\/public\/v2\/users&#8221;<\/b><span style=\"font-weight: 400;\">: This variable holds the specific endpoint of the API being tested.<\/span><\/li>\n\n\n\n<li><b>String page = &#8220;2&#8221;<\/b><span style=\"font-weight: 400;\">: This variable holds a query parameter value for the page number.<\/span><\/li>\n\n\n\n<li><b>Response response = RestAssured.given():<\/b> <span style=\"font-weight: 400;\">It starts the construction of an HTTP request. Then, various methods <\/span><b>(baseUri(), queryParam(), headers(), header())<\/b><span style=\"font-weight: 400;\"> are chained to it to specify details like the base URI, query parameters, and headers. Finally, the request is sent using the <\/span><b>.when().get(endpoint) chain<\/b><span style=\"font-weight: 400;\">, which sends a GET request to the specified endpoint. The response is then captured and stored in the response variable.<\/span><\/li>\n\n\n\n<li><b>.then().log().all().extract().response()<\/b><span style=\"font-weight: 400;\">: This logs all details of the response and extracts it.<\/span><\/li>\n\n\n\n<li><b>int statusCode = response.getStatusCode()<\/b><span style=\"font-weight: 400;\">: This retrieves the status code from the response.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">s<\/span><b>oftAssert.assertEquals(statusCode, 200, &#8220;Response code is not 200&#8221;)<\/b><span style=\"font-weight: 400;\">: This checks if the status code equals 200. If it doesn&#8217;t, it will record a failure with the message &#8220;Response code is not 200&#8221;. However, because it&#8217;s a soft assertion, the test will continue even if this assertion fails.<\/span><\/li>\n\n\n\n<li><b>softAssert.assertAll()<\/b><span style=\"font-weight: 400;\">: This line ensures that all soft assertions are evaluated. If any of them fail, it will throw an assertion error at the end of the test.<\/span><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 6: Create Test Class as mentioned in step-5 to test path parameter<\/b><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Write a test method annotated with @Test that will contain your test logic.<\/b><\/li>\n<\/ul>\n\n\n\n<p><b><\/b><span style=\"font-weight: 400;\">The code below <\/span><span style=\"font-weight: 400;\">utilizes the RestAssured library to test an API with path parameters.<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">Here, {<\/span><b>userId}<\/b><span style=\"font-weight: 400;\"> is a path parameter. It will fetch the details of the user for the mentioned user Id.<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"635\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/path-parameter-test.png\" alt=\"Path Parameter Test in Rest Assured\" class=\"wp-image-29870\" title=\"Testing Path Parameters in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"635\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20635%22%3E%3C%2Fsvg%3E\" alt=\"Path Parameter Test in Rest Assured\" class=\"wp-image-29870 lazyload\" title=\"Testing Path Parameters in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/path-parameter-test.png\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">In the above code, <\/span><b>.pathParam(\u201cuserId\u201d,userId)<\/b><span style=\"font-weight: 400;\"> is used to specify a path parameter named <\/span><b>&#8220;userId&#8221;<\/b><span style=\"font-weight: 400;\"> and its corresponding value. The first argument is the name of the path parameter, and the second argument is the value you want to assign to it.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 7:Create Test Class as mentioned in Step-5, to set cookies.<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Please refer to the image below for the code, to set the cookies of the given url.<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"892\" height=\"724\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/setting-cookies.png.png\" alt=\"Setting Cookies in Rest Assured\" class=\"wp-image-29900\" title=\"Cookies Setup in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"892\" height=\"724\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20892%20724%22%3E%3C%2Fsvg%3E\" alt=\"Setting Cookies in Rest Assured\" class=\"wp-image-29900 lazyload\" title=\"Cookies Setup in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/setting-cookies.png.png\"><\/figure>\n\n\n\n<ul class=\"new-li-design\">\n    <li>1. <b>public class RestAssuredCookieTest :<\/b> This line declares a Java class name.<\/li>\n    <li>2. <b>public void verifySetCookies() throws InterruptedException:<\/b> This line declares a method named verifySetCookies which doesn&#8217;t return anything (void) and can throw an InterruptedException.<\/li>\n    <li>3. <b>ChromeOptions options = new ChromeOptions():<\/b> This line creates an instance of ChromeOptions, which allows to specify various options and settings for ChromeDriver.<\/li>\n    <li>4. <b>SoftAssert softAssert = new SoftAssert():<\/b> This line creates an instance of SoftAssert, which is used to perform soft assertions in the test. Soft assertions allow the test to continue running even if one or more assertions fail.<\/li>\n    <li>5. <b>WebDriver driver = new ChromeDriver(options):<\/b> This line creates an instance of ChromeDriver with the previously defined options. This initializes a new Chrome browser session.<\/li>\n    <li>6. <b>String url = &#8220;https:\/\/google.com&#8221;:<\/b> This line declares a variable url and assigns it the value &#8220;https:\/\/google.com&#8221;, which is the URL that will be tested.<\/li>\n    <li>7. <b>RestAssured.baseURI = url:<\/b> This line sets the base URI for RestAssured, which means all subsequent requests made with RestAssured will be relative to this URL.<\/li>\n    <li>8. <b>Cookies cookies = RestAssured.given().get().getDetailedCookies():<\/b> This line sends a GET request to the base URL using RestAssured and retrieves the detailed cookies from the response.<\/li>\n    <li>9. <b>cookie.getName():<\/b> It  returns the name of the cookie. In HTTP cookies, the name is the identifier of the cookie.<\/li>\n    <li>10. <b>cookie.getValue(): <\/b>It  returns the value of the cookie. It represents the content or the value associated with the cookie.<\/li>\n    <li>11. <b>cookie.getDomain():<\/b> It returns the domain associated with the cookie. The domain specifies the domain for which the cookie is valid. This is typically the domain of the website that set the cookie.<\/li>\n    <li>12. <b>cookie.getPath():<\/b> This method returns the path associated with the cookie. The path specifies the URL path for which the cookie is valid. It restricts the cookie to be sent only to URLs with that path or its subdirectories.<\/li>\n    <li>13. <b>cookie.getExpiryDate():<\/b> This returns the expiry date of the cookie. The expiry date determines the lifetime of the cookie. Once the expiry date is reached, the cookie is considered expired and is deleted from the browser.<\/li>\n    <li>14. <b>cookie.isSecured():<\/b> This method returns a boolean indicating whether the cookie is secured or not. If true, it means the cookie\n     should only be sent over HTTPS connections.<\/li>\n    <li>15. <b>cookie.isHttpOnly(): <\/b>This method returns a boolean indicating whether the cookie is HTTP only or not. If true, it means the cookie can only be accessed via HTTP requests and cannot be accessed by client-side scripts such as JavaScript. This helps mitigate certain types of attacks, like cross-site scripting (XSS).<\/li>\n    <li>16. <b>driver.get(url):<\/b> This line navigates the Chrome browser to the specified URL.<\/li>\n    <li>17. <b>driver.manage().window().maximize():<\/b> This line maximizes the browser window.<\/li>\n    <li>18. <b>Thread.sleep(3000):<\/b> It will pause the execution of the test for 3000 milliseconds (3 seconds). This is often used for demonstration purposes or in cases where waiting is required, but it&#8217;s generally not recommended for regular test scripts.<\/li>\n    <li>19. <b>for (io.restassured.http.Cookie cookie :<\/b> cookies.asList()) : This line starts a loop iterating over each cookie retrieved by RestAssured.<\/li>\n    <li style=\"text-align:left\">20.<b>org.openqa.selenium.Cookie mobisoftCookie = new org.openqa.selenium.Cookie():<\/b> Inside the loop, it creates an instance of org.openqa.selenium.Cookie, which is used to represent a browser cookie in Selenium WebDriver.<\/li>\n    <li>21. <b>driver.manage().addCookie(mobisoftCookie):<\/b> It adds the cookie to the browser session managed by WebDriver.<\/li>\n    <li>22. <b>softAssert.assertNotNull(driver.manage().getCookies(), &#8220;Cookie is not set&#8221;):<\/b> This checks if cookies are set in the browser using a soft assertion.<\/li>\n    <li>23. <b>System.out.println(&#8220;Cookies set: &#8221; + driver.manage().getCookies()):<\/b> This line prints out the cookies that are set in the browser.<\/li>\n    <li>24. <b>softAssert.assertAll():<\/b> It asserts all the soft assertions made in the test. If any of them fail, it will throw an assertion error.<\/li>\n    <li>25. <b>driver.close():<\/b> This line closes the browser window and ends the WebDriver session.<\/li>\n    <\/ul>\n    <style>\n    ul.new-li-design li:before {\n        display: none;\n    }\n    <\/style>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 8: Configure TestNG<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">To configure testng.xml, <\/span><b>Right click <\/b><span style=\"font-weight: 400;\">on <\/span><b>Project\u2192TestNG\u2192 Convert to Testng (Please refer image given below)<\/b><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"1016\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-conversion.png\" alt=\"Converting to TestNG in Rest Assured\" class=\"wp-image-29872\" title=\"TestNG Conversion in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"1016\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%201016%22%3E%3C%2Fsvg%3E\" alt=\"Converting to TestNG in Rest Assured\" class=\"wp-image-29872 lazyload\" title=\"TestNG Conversion in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-conversion.png\"><\/figure>\n\n\n\n<p><b>Once the TestNg.xml file is created. Include Test classes in the xml file.<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Here in the XML configuration file below, defines a TestNG suite named &#8220;Suite&#8221; with one test named &#8220;Test&#8221;, which includes three test classes: &#8220;PathParameterTest&#8221;, &#8220;QueryParameterTest&#8221;, and &#8220;RestAssuredCookieTest&#8221;. When executed, TestNG will run the tests defined in these classes according to the specified settings.<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"515\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-xml-file.png\" alt=\"TestNG XML File for Rest Assured\" class=\"wp-image-29873\" title=\"TestNG Configuration File in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"515\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20515%22%3E%3C%2Fsvg%3E\" alt=\"TestNG XML File for Rest Assured\" class=\"wp-image-29873 lazyload\" title=\"TestNG Configuration File in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-xml-file.png\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Step 9: Run the Test:<\/b><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Run test class as a TestNG test framework configuration.<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400;\">Right click on testng.xml file\u2192Run as\u2192TestNg Suite <\/span><b>(Refer below image)<\/b><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"855\" height=\"540\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-suite.png\" alt=\"TestNG Suite for Rest Assured\" class=\"wp-image-29874\" title=\"TestNG Suite Configuration in Rest Assured\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"540\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20540%22%3E%3C%2Fsvg%3E\" alt=\"TestNG Suite for Rest Assured\" class=\"wp-image-29874 lazyload\" title=\"TestNG Suite Configuration in Rest Assured\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/testng-suite.png\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">That&#8217;s it! We have created a RestAssured program using Selenium WebDriver in Java to test an API. This program sends an HTTP GET request to the specified endpoint, extracts response details, and performs Selenium actions on a webpage. Finally, it asserts the API response status code using TestNG assertions.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Conclusion:<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Mastering the intricacies of headers, cookies, and parameters is paramount for ensuring the efficiency and accuracy of API automation testing. With Rest Assured as your ally, harnessing the power of automation becomes more accessible than ever.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">At <\/span><a href=\"https:\/\/mobisoftinfotech.com\/\"><b>Mobisoft Infotech<\/b><\/a><span style=\"font-weight: 400;\">, we understand the importance of robust testing methodologies in delivering high-quality software solutions. Our expertise in API testing, coupled with cutting-edge tools like Rest Assured, empowers businesses to achieve seamless integration, superior performance, and unparalleled user experiences.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Explore our comprehensive range of services, including <\/span><a href=\"https:\/\/mobisoftinfotech.com\/services\/test-automation\"><b>Automation Testing Services<\/b><\/a><span style=\"font-weight: 400;\">, to embark on a journey of innovation and excellence in software development. Partner with us today and unlock the full potential of your digital initiatives.<\/span><\/p>\n\n\n\n<p>To download the source code for the sample , please&nbsp;<a href=\"https:\/\/mobisoftinfotech.com\/assets\/images\/blog\/restassured\/RestAssured.zip\">click here<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/mobisoftinfotech.com\/contact-us?utm_source=blog_cta&#038;utm_campaign=cart-aapi-automation-testing-headers-cookies-parameters-rest-assured-cta2\"><noscript><img decoding=\"async\" width=\"855\" height=\"150\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/superior-api-testing.png\" alt=\"Superior API Testing\" class=\"wp-image-29884\" style=\"width:840px;height:auto\" title=\"Elevate Your Testing Game\"><\/noscript><img decoding=\"async\" width=\"855\" height=\"150\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20855%20150%22%3E%3C%2Fsvg%3E\" alt=\"Superior API Testing\" class=\"wp-image-29884 lazyload\" style=\"width:840px;height:auto\" title=\"Elevate Your Testing Game\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/superior-api-testing.png\"><\/a><\/figure>\n\n\n<div class=\"related-posts-section\"><h2>Related Posts<\/h2><ul class=\"related-posts-list\"><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/emergence-of-urban-mobility-experience\">Emergence of Urban Mobility Experience: Past, Present, and Future<\/a><\/li><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/best-ways-to-improve-landing-page-for-better-conversion-rate\">Best Ways To Improve Landing Page For Better Conversion Rate<\/a><\/li><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/patient-portal-development-in-2023\">Patient Portal Development: What to Know for Your Healthcare Business in 2023?<\/a><\/li><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/react-19-shadcn-ui-integration-tutorial\">Integrating Shadcn UI with React 19: A Step-by-Step Tutorial<\/a><\/li><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/remote-patient-monitoring-system-in-2021\">Updated CPT Codes Elevating Remote Patient Monitoring Systems in 2021<\/a><\/li><li><a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/future-of-vip-transport-luxury-innovation-trends\">The Future of VIP Transport: Luxury &amp; Innovation Trends<\/a><\/li><\/ul><\/div>\n\n\n<div class=\"modern-author-card\">\n    <div class=\"author-card-content\">\n        <div class=\"author-info-section\">\n            <div class=\"author-avatar\">\n                <noscript><img decoding=\"async\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/Purva.png\" alt=\"Purva Kadam\"><\/noscript><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"Purva Kadam\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/Purva.png\" class=\" lazyload\">\n            <\/div>\n            <div class=\"author-details\">\n                <h3 class=\"author-name\">Purva Kadam<\/h3>\n                <p class=\"author-title\">QA Engineer<\/p>\n                <a href=\"javascript:void(0);\" class=\"read-more-link read-more-btn\" onclick=\"toggleAuthorBio(this); return false;\">Read more <noscript><img decoding=\"async\" src=\"\/assets\/images\/blog\/Vector.png\" alt=\"expand\" class=\"read-more-arrow down-arrow\"><\/noscript><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"expand\" class=\"read-more-arrow down-arrow lazyload\" data-src=\"\/assets\/images\/blog\/Vector.png\"><\/a>\n                <div class=\"author-bio-expanded\">\n                    <p>Purva Kadam is a QA at <a href=\"https:\/\/mobisoftinfotech.com\" target=\"_blank\">Mobisoft Infotech<\/a>, Has 4 years of hands-on experience in Manual\/Automation testing. My focus is on leveraging automation tools and best practices to streamline testing processes and deliver reliable, high-performing software solutions. My journey in automation testing is a commitment to pushing the boundaries of whats possible.<\/p>\n                    \n                    <a href=\"javascript:void(0);\" class=\"read-more-link read-less-btn\" onclick=\"toggleAuthorBio(this); return false;\" style=\"display: none;\">Read less <noscript><img decoding=\"async\" src=\"\/assets\/images\/blog\/Vector.png\" alt=\"collapse\" class=\"read-more-arrow up-arrow\"><\/noscript><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"collapse\" class=\"read-more-arrow up-arrow lazyload\" data-src=\"\/assets\/images\/blog\/Vector.png\"><\/a>\n                <\/div>\n            <\/div>\n        <\/div>\n        <div class=\"share-section\">\n            <span class=\"share-label\">Share Article<\/span>\n            <div class=\"social-share-buttons\">\n                <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fmobisoftinfotech.com%2Fresources%2Fblog%2Fapi-automation-testing-headers-cookies-parameters-rest-assured\" target=\"_blank\" class=\"share-btn facebook-share\"><i class=\"fa fa-facebook-f\"><\/i><\/a>\n                <a href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fmobisoftinfotech.com%2Fresources%2Fblog%2Fapi-automation-testing-headers-cookies-parameters-rest-assured\" target=\"_blank\" class=\"share-btn linkedin-share\"><i class=\"fa fa-linkedin\"><\/i><\/a>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n<script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"BlogPosting\",\n  \"mainEntityOfPage\": {\n    \"@type\": \"WebPage\",\n    \"@id\": \"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\"\n  },\n  \"headline\": \"API Automation Testing: Headers, Cookies & Parameters with Rest Assured\",\n  \"description\": \"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.\",\n  \"image\": \"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png\",  \n  \"author\": {\n    \"@type\": \"Person\",\n    \"name\": \"Purva Kadam\"\n  },  \n  \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": \"Mobisoft Infotech Pvt Ltd\",\n    \"logo\": {\n      \"@type\": \"ImageObject\",\n      \"url\": \"https:\/\/mobisoftinfotech.com\/assets\/images\/MI_Logo.svg\"\n    }\n  },\n  \"datePublished\": \"2024-05-16\"\n}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>In API automation testing, ensuring proper handling of headers, cookies, and parameters is essential for accurately simulating real-world API interactions. These elements carry crucial information between the client and the server, influencing the behavior and outcome of API requests and responses. Rest Assured provides convenient methods for setting headers, adding cookies, and specifying various types [&hellip;]<\/p>\n","protected":false},"author":83,"featured_media":29886,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[286],"tags":[4159,4171,4166,4169,4168,4167,4160,4162,4164,4163,4165,4161,4170],"class_list":["post-29860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-api-automation-testing","tag-api-testing-automation-frameworks","tag-api-testing-best-practices","tag-api-testing-strategies","tag-api-testing-techniques","tag-api-testing-tools","tag-api-testing-with-rest-assured","tag-automated-api-testing","tag-cookies-in-api-testing","tag-headers-in-api-testing","tag-parameters-in-api-testing","tag-rest-assured-framework","tag-rest-assured-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured<\/title>\n<meta name=\"description\" content=\"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured\" \/>\n<meta property=\"og:description\" content=\"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\" \/>\n<meta property=\"og:site_name\" content=\"Mobisoft Infotech\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-16T13:39:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-30T12:09:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/og-API-Automation-Testing.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"525\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Purva Kadam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Purva Kadam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#article\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\"},\"author\":{\"name\":\"Purva Kadam\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159\"},\"headline\":\"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured\",\"datePublished\":\"2024-05-16T13:39:49+00:00\",\"dateModified\":\"2025-12-30T12:09:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\"},\"wordCount\":2382,\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png\",\"keywords\":[\"API Automation Testing\",\"API Testing Automation Frameworks\",\"API Testing Best Practices\",\"API Testing Strategies\",\"API Testing Techniques\",\"API Testing Tools\",\"API Testing with Rest Assured\",\"Automated API Testing\",\"Cookies in API Testing\",\"Headers in API Testing\",\"Parameters in API Testing\",\"Rest Assured Framework\",\"Rest Assured Tutorial\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\",\"name\":\"API Automation Testing: Headers, Cookies & Parameters with Rest Assured\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage\"},\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png\",\"datePublished\":\"2024-05-16T13:39:49+00:00\",\"dateModified\":\"2025-12-30T12:09:00+00:00\",\"author\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159\"},\"description\":\"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.\",\"breadcrumb\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png\",\"contentUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png\",\"width\":855,\"height\":391,\"caption\":\"Rest Assured Framework Overview\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mobisoftinfotech.com\/resources\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/\",\"name\":\"Mobisoft Infotech\",\"description\":\"Discover Mobility\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159\",\"name\":\"Purva Kadam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g\",\"caption\":\"Purva Kadam\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"API Automation Testing: Headers, Cookies & Parameters with Rest Assured","description":"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured","og_locale":"en_US","og_type":"article","og_title":"API Automation Testing: Headers, Cookies & Parameters with Rest Assured","og_description":"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.","og_url":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured","og_site_name":"Mobisoft Infotech","article_published_time":"2024-05-16T13:39:49+00:00","article_modified_time":"2025-12-30T12:09:00+00:00","og_image":[{"width":1000,"height":525,"url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/og-API-Automation-Testing.png","type":"image\/png"}],"author":"Purva Kadam","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Purva Kadam","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#article","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured"},"author":{"name":"Purva Kadam","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159"},"headline":"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured","datePublished":"2024-05-16T13:39:49+00:00","dateModified":"2025-12-30T12:09:00+00:00","mainEntityOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured"},"wordCount":2382,"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png","keywords":["API Automation Testing","API Testing Automation Frameworks","API Testing Best Practices","API Testing Strategies","API Testing Techniques","API Testing Tools","API Testing with Rest Assured","Automated API Testing","Cookies in API Testing","Headers in API Testing","Parameters in API Testing","Rest Assured Framework","Rest Assured Tutorial"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured","url":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured","name":"API Automation Testing: Headers, Cookies & Parameters with Rest Assured","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage"},"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png","datePublished":"2024-05-16T13:39:49+00:00","dateModified":"2025-12-30T12:09:00+00:00","author":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159"},"description":"Discover advanced API automation testing techniques using Rest Assured. Master handling headers, cookies, and parameters for seamless workflows.","breadcrumb":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#primaryimage","url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png","contentUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2024\/05\/api-automation-testing-rest-assured.png","width":855,"height":391,"caption":"Rest Assured Framework Overview"},{"@type":"BreadcrumbList","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/api-automation-testing-headers-cookies-parameters-rest-assured#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mobisoftinfotech.com\/resources\/"},{"@type":"ListItem","position":2,"name":"API Automation Testing: Headers, Cookies &amp; Parameters with Rest Assured"}]},{"@type":"WebSite","@id":"https:\/\/mobisoftinfotech.com\/resources\/#website","url":"https:\/\/mobisoftinfotech.com\/resources\/","name":"Mobisoft Infotech","description":"Discover Mobility","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/f2bd71c55ee423097a0205df4f540159","name":"Purva Kadam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/46ab65203c1448e2fd910a0f888fe352e7aae5da6370915b890420d150c95743?s=96&r=g","caption":"Purva Kadam"}}]}},"_links":{"self":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/29860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/users\/83"}],"replies":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/comments?post=29860"}],"version-history":[{"count":26,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/29860\/revisions"}],"predecessor-version":[{"id":46294,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/29860\/revisions\/46294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/media\/29886"}],"wp:attachment":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/media?parent=29860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/categories?post=29860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/tags?post=29860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}