File Uploads and Multipart Requests

The File Uploads feature requires a qualifying plan. Contact Sales to get started.

The File Uploads feature enables teams to upload files to their BlazeMeter API Monitoring account that can be used to test and monitor endpoints that require multipart/form-data information, such as uploading a JSON file, an image, or a combination of multiple file types.

Manage Files

The team owner can access and manage a team's files. In the File Uploads page you can find three main sections: Upload a File, Existing Files, and History.

  • Upload a File allows the team owner to upload files to the team's account. There is a limit of 5 MB per file, and a total limit of 50 files per team.
  • Existing Files will display all the files that are available for use under the account's team. You can see the filenames as well as delete any files by clicking on the trash icon on the right side.
  • History will display a timeline of all the actions related to uploading and deleting files. You can see which user uploaded or deleted which files, as well as a timestamp with the exact time.

Upload Files to the File Library

Only team owners can see the File Uploads menu and upload or delete files.
Out of the 19 locations that we provide to run the tests from, we do not support file uploads for 2 locations (US Illinois and US Texas). The regular tests will run in these locations.

Follow these steps:

  1. Click your profile on the top-right, and select File Uploads from the dropdown.
    fileuploads.png
  2. In the Upload a file section, click the Choose File button to choose the file you want to upload.
  3. Click the Upload File button to upload your file. The maximum file size accepted is 5 MB, and there are no restrictions on file extensions.
    file library

You should now see your file available under the Existing Files section, as well as a new entry under the History section.

The File Library page view that a team owner can access, showing the photo.jpg file uploaded in the last step under the section Existing Files, and History

Make Requests with a Multipart File Body or a Binary File

Follow these steps:

  1. Select a bucket and create a new test, or open an existing test in the test editor.

    4-new-test.png

  2. Create a new Request step, and set your endpoint method to POST, PUT, PATCH, or DELETE.
  3. Under Parameters, select one of the following:
    • + Add Multipart Form Parameters: Choose this option to pass a file in multiple parts.
    • + Add Binary Body: Choose this option to pass binary files such as images, video files, PDF, zip, HTML, or XML files.
  4. Name your file parameter (required for multipart requests, optional for binary body), and click the drop-down next to it to select the file from your available uploaded files. BlazeMeter API Monitoring will try to set the Content-Type based on the file extension you have selected, such as application/json or image/jpeg, but you can also manually edit it.
    An API test in editor mode, highlighting the parameters created after clicking on the Add Multipart Form Parameters option, showing a header with the name image, and the value photo.jpg from a drop-down, and another header for Content-Type, and value image/jpeg
    For binary files, the Content-Type can be found under Headers:
  5. Click Save & Run.

After your test runs, you can click the new test run result on the left-hand side to check the details for your request. By expanding the details of a successful request step with the multipart file or binary file body, you should see:

  • Under the Request tab, the file that you uploaded with your request (clicking on the link will download that file), as well as the body that we parsed and sent to the endpoint.
  • Under the Response tab, any files that were returned by the API (clicking on the link will download that file), as well as any other headers and body information.

Decode and Pass Binary Content to Another Request

You can decode and pass your binary content to another request.

Example: For the following binary content:

  1. Perform a GET request on the binary file. The binary content is extracted into a variable under Post-response Scripts:

    variables.set("img", response.body);
  2. In another request, under Pre-request Scripts, add the variable in

    request.body
    and populate request.content_type with the information found in the header:

    request.body = variables.get("img");
    request.content_type = "image/jpeg"
  3. Click Save & Run.

For more information on chaining requests, see Dynamic Data and Request Chaining.