How to update data with HTTP PUT

  • Last update on August 8th, 2024

Workflows are not available in the Essentials solution.

 

In this guide, we'll explain how to use an HTTP PUT Workflow action to update data. This operation is widely used in RESTful APIs to modify existing resources. We'll simulate updating a user's profile information on a server.

Prerequisites

  • HTTP client access: you need access to an HTTP client or a platform that supports configuring HTTP actions.
  • Endpoint URL: use an endpoint that allows data updates via the PUT method. For this tutorial, we'll use https://example.com/api/users/{userId}, where {userId} represents the user's ID.
  • Authentication: if the endpoint requires it, be ready with your API key, bearer token, or another authentication method.
  • Data format knowledge: understand the data format the server expects, usually JSON.


Execution inputs

Identify the data you want to update. In our example, we aim to change a user's email and phone number:

  • userId: the user's unique identifier.
  • New Email: the updated email address.
  • New Phone Number: the updated phone number.

Configuring the HTTP PUT action

Step 1: Set up the action

Add a new action to your Workflow. Navigate to the “HTTP Integrations” category and select the “HTTP API PUT” action. This utilizes the PUT method to transmit data to your chosen endpoint.

Step 2: Configure the URL

Adjust the URL to target the specific user profile. Replace {userId} with the actual user ID. For instance, https://example.com/api/users/{userId}

Step 3: Configure the Body

The request body should include the new user data. Assuming JSON format is expected, set up the body accordingly.

Executing the Workflow

Once the HTTP PUT action is configured, save and publish your Workflow. Executing it will send a PUT request to the server with the user's updated information. A successful operation is usually indicated by the server's response with a status code such as “200 OK”, and it may include the updated resource.