Send PUT requests

A PUT request allows you to update an existing API resource.

Before sending a PUT request, make sure the resource exists by sending a GET request as described earlier.

After you verified that the resource you want to modify exists, create a payload, that is data used to update the resource:

  1. Enter the following values into the range A1:C2:

    ABC
    1 id first_name last_name
    21MaryDoe

    The id value here provides the ID of the resource to be updated.

  2. In cell A3, use the following formula to create a frame from the values entered into the range A1:C2:

    =FRAME(A1:C2)
    Copy to clipboard
  3. In cell B3, use the following formula to create a JSON string from the frame:

    =JSON(A3)
    Copy to clipboard

    Cell B3 contains the request payload.

Send the request and verify the response, like so:

  1. In an empty cell, enter the PUT() function with the URL "https://reqres.in/api/users/2" as the first argument and the address of the cell containing the JSON string as the second argument.

    After a while, the PUT() function returns a response in the form of a frame.

  2. Open the frame by selecting the cell and pressing Shift+Enter.

    Make sure that the nested spreadsheet that opens contains a date under updatedAt, which for this particular REST API service means that the call is successful.

Contents