Send POST requests

This section describes how to use a POST request to send data to an API to create a resource, and then assert that the call is successful.

Before sending a POST request, create a payload, that is data used to create a resource:

  1. Enter the following values into the cell range A1:B2:

    AB
    1first_namelast_name
    2JohnDoe
  2. In cell C1, use the following formula to create a frame from the values in the range A1:B2:

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

    =JSON(C1)
    Copy to clipboard

Send the request and verify the response as follows:

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

    After a while, the POST() 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 nested spreadsheet with a date under createdAt, which for this particular REST API service means that the call is successful.

Contents