Send attachments

You can send attachments with your API messages. This enables you to create multipart messages that contain different sets of data.

To send an attachment, you have to add it to your message first. You can add an attachment using the following options:

Add Files

To add a file via the Add Files button, follow the steps below:

  1. In API Scan, select a message and click the Add Files icon.

  2. To add a file as an attachment, select Attachment from the drop-down menu.

Click Add Files

  1. In the subsequent dialog, select the file you want to attach and click Open.

    API Scan adds your file as an attachment in the Attachments tab. It automatically uses the file name of your attachment, adds the file path, and populates the field Content-Type based on the file format.

  2. API Scan automatically generates the Content-Type header as multipart/form-data along with the boundary.

    If you fill in the Payload of the request, and there are also attachments, you need to add the Content-Type header manually, and populate it with the appropriate value. For example, for JSON message payloads, the appropriate Content-Type value is application/json.

File attachment in the Attachments tab

  1. To use the Message Transmission Optimization Mechanism (MTOM) for your message transmission, select Enable MTOM. For more information on using MTOM, see chapter "Enable MTOM support".

    After enabling it, you can specify the following information:

    • Content-Transfer-Encoding. If you don't specify a different value, API Scan uses binary.

    • Content-Type. If you don't specify a different value, API Scan uses multipart/related.

  1. Optionally, select Omit filename* to omit the parameter filename* from the header Content-Disposition. This can help in case the web service or client application can't process the parameter filename* correctly and, therefore, rejects the message you send.

Attachments tab

To add a file as an attachment directly in the Attachments tab, follow the steps below:

  1. In the API Scan window, select a message and click the Attachments tab in the message section.

  1. Specify the name of your attachment in the Name entry field.

    If you do not define a Name, API Scan automatically uses the file name of your attachment.

  1. To add the attachment, click into the File entry field.

  2. Click on the icon. In the subsequent dialog, select the file you want to attach and click Open.

    API Scan automatically populates the field Content-Type, based on the format of your attachment.

  3. API Scan automatically generates the Content-Type header as multipart/form-data along with the boundary.

    If you fill in the Payload of the request, and there are also attachments, you need to add the Content-Type header manually, and populate it with the appropriate value. For example, for JSON message payloads, the appropriate Content-Type value is application/json.

File attachments in the Attachments tab

  1. To use the Message Transmission Optimization Mechanism (MTOM) for your message transmission, select Enable MTOM. For more information on using MTOM, see chapter "Enable MTOM support".

    After enabling it, you can specify the following information:

    • Content-Transfer-Encoding. If you don't specify a different value, API Scan uses binary.

    • Content-Type. If you don't specify a different value, API Scan uses multipart/related.

  2. Optionally, select Omit filename* to omit the parameter filename* from the header Content-Disposition. This can help in case the web service or client application can't process the parameter filename* correctly and, therefore, rejects the message you send.