Applies to ReadyAPI 3.0, last modified on December 06, 2019

REST sends attachments as MIME parts in a message with multipart/form-data media type.

Requirements

To send an attachment, your request must have a payload. For example, a GET request cannot have attachments, as it cannot have payload.

Sending a Request to REST Services

In the Message Body

To send an attachment to a REST service:

  1. Open the Attachments panel and click Add Attachment.

    Attachments in ReadyAPI: Adding REST attachments

    Click the image to enlarge it.

  2. Select the file you want to send. ReadyAPI will ask you if want to cache it in the request. Uncached attachments are read from the file directly each time the request is sent. Cached attachments are stored in the project, so you can remove the original file.

  3. Open the Request editor and set the request media type as multipart/form-data or multipart/mixed.

    Attachments in ReadyAPI: Setting media type

    Click the image to enlarge it.

With Parameters Specified in the QUERY String

Some services require that you send a reference to the file in the QUERY parameter. In this case, additional configuration is required:

  • Attach the file to the project as described above.

  • Enable the Post QueryString option.

    Attachments in ReadyAPI: Setting the Post QueryString option

    Click the image to enlarge it.

  • Make sure the parameter that you use to attach the file has the QUERY type. Then, specify the file to be attached by using file:filename.txt as a parameter value.

    Tip: You can specify file:C:/<folder>/<filename> as a parameter value to attach a file from the computer. It will not be cached in the project.
    Attachments in ReadyAPI: Attachment configuration

    Click the image to enlarge it.

See Also

SOAP Attachments
Attachments

Highlight search results