Use the Get method actions from the REST Web Services package to retrieve or get the information identified by parameters included in the URI.

This example uses endpoints from the Swagger Petstore sample API (Petstore) to demonstrate how the Get method action retrieves a list of all the available pets from the Petstore database and exports the list to a text file in the local system.
Note: The Get method action does not take any request body.

Prerequisites

Ensure that you create a text file in your local system to save the response body information.

Procedure

  1. Create a new bot.
    1. Log in to your instance of the Control Room.
    2. Click Automation on the left panel.
    3. Click Create > Task Bot.
    4. Enter an appropriate bot name in the Create Task Bot modal.
    5. Click Choose, and follow the prompts to select an appropriate storage location.
      The default bot storage location is \Bots\ .
    6. Click Create & edit.
  2. Double-click or drag the REST Web Services > Get method action.
  3. Enter the following URI in the URI section:
    https://petstore3.swagger.io/api/v3/pet/findByStatus?status=available
  4. Select System in Proxy configuration.
  5. By default, No Authentication is set as the Authentication Mode.
    For APIs that require authentication, select an appropriate authentication method from the Authentication Mode drop down. For more information about authentication modes, see REST Web Services package.
  6. Optional: Configure the following Advanced options:
    • Capture failure response: Enable this option to log the failure responses in the output file.
    • Allow insecure connection when using https: Enable this option to allow insecure connection when using an https server. The transferred data is insecure and visible.
    • Accept Cookies: Enable this option to store the cookies from the URI for subsequent API calls within the automation. The cookies are deleted automatically when automation is complete.
    • Download file: Enable this option to download the file locally. Enter the file path to the file location. You can also enable the check box to overwrite an existing file.

    For more information on the Advanced options, see REST Web Services package.

  7. Create a dictionary-type output variable named Output using the Create variable option in Assign the output to a variable.
    The GET request imports the response body information into this variable.
  8. Double-click or drag the Log text to file action to see the response body.
    The Log text to file action exports the response body from the dictionary variable to the created text file.
  9. Enter the file path to the created text file in File path.
  10. Enter $Output{Body}$ in the Enter text to log field.
  11. Click Save and then click Run.
    The bot retrieves the response body and saves it to the text file.
    Note: You cannot use the Get method to download an exported bot or file by entering the download API endpoint as the URI.