API Multipart File Upload
Multipart File Upload
This feature allows you to upload one or more files in a single multipart request using the Webservice object. The postRestRequest action automatically detects variables representing file paths and includes them as multipart file parts in the request.
When to use
Use this when your test case needs to send one or more files to an API endpoint that supports multipart file uploads (e.g., document management, batch image upload, etc.).
Required Variables
%filePath%,%filePath1%,%filePath2%, ... : Each variable should contain the absolute path to a file you want to upload. You can define as many as needed for your scenario.
How to use multipart file upload
- Set the endpoint using
setEndPoint. - Add the header
Content-Type=multipart/form-datausingaddHeader. - Use
AddVarto define each file path variable (e.g.,%filePath%,%filePath2%). - You can also use action
addUrlParam(Input -@key=value) to add each text field to combine both files and text data in a single request. - Call
postRestRequestwith{}as input. The action will automatically include all file path variables as multipart file parts. - Assert the response code and close the connection as usual.


Notes
- Each file path variable must point to an existing file on your system.
- Ensure the endpoint supports multipart file uploads.