Upload file with Post method

Use the Post method action in the REST Web Service package to upload a file or text.

This example uses endpoints from the Petstore sample API (Petstore) to demonstrate uploading a new file or text using a multipart/form-data.

Procedure

  1. Use the Post method action in conjunction with an API that allows uploading a file.
    1. Double-click or drag the REST Web Services > Post method action.
    2. Enter the following URI:
      https://petstore.swagger.io/v2/pet/112/uploadImage
    3. From the Content type drop-down, select multipart/form-data.
      Using Rest Web Service - Post - Content type
    4. Add the file parameter and provide the path of the file to be uploaded.
    5. Add any other required parameters. For instance, this API takes additonatalMetadata (for example, "hello"), which is a text input parameter. The additional parameter will also be uploaded.
  2. Assign the output to a variable, for example, Test123.
    Using Rest Web Service - Post - Assign Output Variable
  3. Print the output in a message box.
    Using Rest Web Service - Post - Print output