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:
Enter the following values into the range A1:C2:
A B C 1 id first_name last_name 2 1 Mary Doe The id value here provides the ID of the resource to be updated.
In cell A3, use the following formula to create a frame from the values entered into the range A1:C2:
=FRAME(A1:C2)In cell B3, use the following formula to create a JSON string from the frame:
=JSON(A3)Cell B3 contains the request payload.
Send the request and verify the response, like so:
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.
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.