API Automation Using Patch Method

Modified on Tue, 16 Sep at 6:48 PM

TABLE OF CONTENTS

1. Overview

1.1 Example

1.2 To automate API automation using Patch method, leveraging algoQA

1. Overview

The PATCH method is an HTTP method used to update the specific values of the resource.

Using the PATCH method, you only send the data that needs updating, which can save bandwidth and reduce the amount of time taken for a webpage to load and become interactive. This method is helpful for mobile users or in situations where network connectivity is slow or unreliable.

1.1 Example

For example, the following request example updates the user name and job in the database for an existing user.

Request:

PATCH - https://api.example.com/users/{user_id}

Here, replace {user_id} with the actual user ID and ensure the URL is valid for the user you want to update. 


Request Header:

Authorization: Bearer <Access-Token>

Content-Type: application/json
Here, replace <Access- token> with the actual access token.


Request Body:

{

   "name": "<username>",   

   "job": "<job title>",    

   "updatedAt": "2024-07-15T07:20:33.050Z" 

}
Here, replace with the actual username and job title. 'updatedAt' field is generated by the system to indicate when the update occurred.


1.2 To automate API automation using Patch method, leveraging algoQA

API automation is similar to the attached document, you need to create Request name and select PATCH as the type and update the required details.  For more information on creating a Request name and selecting the 'Type', refer to the API Automation using API collection 
After clicking 'Send' button to execute this method, you will see the response body as shown in the following screenshot: 

A system generated Feature File is as follows. You can download the generated script and view the report and a unique Id will be generated for each test cases.

 





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article