All Collections
Tutorials
Working with requests larger than 5MB
Working with requests larger than 5MB

Understand how to use the HTTP-File Trigger for pipelines that will receive payloads larger than 5MB.

Iuri Guedes Emer avatar
Written by Iuri Guedes Emer
Updated over a week ago

In scenarios where the payload exceeds the 5MB limit accepted by REST and HTTP triggers, the platform will return an HTTP status 413 with the following message:

{
"message": "Request size limit exceeded"
}

An alternative to handling payloads larger than 5MB is to utilize the HTTP-File Trigger.

When dealing with payloads larger than 5MB, it's necessary to send this information in a file format to the pipeline. Let's illustrate an example using a .json file.

It's crucial to define the correct Content-Type according to the file you're working with. Other examples of Content-Type would be: application/pdf and application/jpeg.

Upon receiving the payload with the HTTP-File trigger, you can observe in the monitoring screen that the payload is received as a file and not in the body key. In this context, the body key will be empty.

To access the sent file, specific handling is required. A common practice is to separate and save the input data of the request in a Session Management component, preserving information such as Headers and QueryAndPath.

The File Reader component has the capability to read the file and transform it into a JSON string. Once the JSON string is obtained, you can use the Double Braces tojson function to convert this string into JSON. In the example of this article, this handling is being done in the JSON Generator component called "tojson data," as shown in the image below.



Now you have the JSON that arrived via file available in the pipeline to be worked on if necessary.

After the tasks and processes executed by the flow, it's time to prepare the return provided by the Pipeline.

It's possible to return both a JSON and a .json file. In the case of writing the file, you can use the File Writer component.

Finally, you can use a JSON Generator component to provide the final response, as shown in the example below:

Did this answer your question?