HTTP File Trigger - Downloads

Discover more about the HTTP File Trigger and how to use it on the Digibee Integration Platform.

HTTP File Trigger downloads large files in a robust and efficient way, calling the GET method.

Parameters

Take a look at the configuration options for the component. Parameters supported by Double Braces expressions are marked with (DB).

ParameterDescriptionDefault valueData type

Methods

Defines the methods accepted by the pipeline.

GET, PUT, POST, PATCH, and DELETE

String

Response Headers (DB)

Headers to be returned by the endpoint when processing in the pipeline is complete. This parameter cannot be left empty and accepts Double Braces. Special characters should not be used in keys, due to possible failures in proxies and gateways.

N/A

Key-value pairs

Add Cross-Origin Resource Sharing (CORS)

Adds the CORS headers to be returned by the endpoint when processing in the pipeline is complete. Cross-Origin Resource Sharing (CORS) is a mechanism that lets you tell the browser which origins are allowed to make requests.

False

Boolean

CORS Headers

Defines CORS specifically for the pipeline and its constraints. To configure globally rather than individually on each pipeline, see the CORS Global article.

N/A

Key-value pairs

Form Data Uploads

Enables/disables the receipt of the form data upload (multipart form data).

True

Boolean

Body Uploads

Enables/disables the receipt of bodies upload.

True

Boolean

Body Upload Content Types

Defines the content types allowed by the pipeline for the bodies upload.

application/pdf, application/jpeg

String

Response Content Types

Defines the response content types allowed by the pipeline - when configuring this response, you determine the response format.

text/xml, application/xml

String

Maximum Timeout

Maximum time (in milliseconds) that the pipeline takes to process information before returning a response. If the processing takes longer than the parameter definition, the request is finished and returns status code 500, but without a body. Default: 30000. Limit: 900000.

30000

Integer

Maximum Request Size

Defines the maximum size of the file in the upload request (in MB). Maximum: 100 MB.

50

Integer

External API

If activated, the option publishes the API in an external gateway.

True

Boolean

Internal API

If activated, the option publishes the API in an internal gateway.

False

Boolean

mTLS enabled API

If the option is activated, the API is published to a gateway dedicated to APIs with mTLS enabled by default. In this case, the access host will be different from the others. The pipeline can have both the External API and Internal API options enabled at the same time, but it is recommended to leave them inactive. This parameter does not support API Key and JWT. To use it in your realm, it is necessary to make a request via chat, and we will send you the necessary information to install this service.

False

Boolean

API Key

If activated, the option will request the key for the API consumption.

False

Boolean

Token JWT

If activated, the option will request the token for the API consumption.

False

Boolean

Basic Auth (Beta Phase)

If the option is activated, the endpoint can only be consumed if a Basic Auth setting is present in the request. This setting can be registered beforehand through the Consumers page in the Digibee Integration Platform.

False

Boolean

Additional API Routes

If activated, the option allows you to add new routes.

False

Boolean

Remove Digibee Prefix from Route

This option is available only when External API and Internal API parameters are disabled, and mTLS enabled API and Additional API Routes parameters are enabled. Set this option to remove the default Digibee route prefix "/pipeline/{realm}/v{n}" from the pipeline route. Learn more about the Remove Digibee Prefix from Route parameter in the section below.

False

Boolean

API Routes

Custom routes.

N/A

String

Rate Limit

If the option is activated, a rate limiting configuration will be applied on the API gateway. This option is only available if API Key or Basic Auth is active. See more about the Rate Limit parameter in the section below.

False

Boolean

Limit by

Defines the entity to which the limits will be applied. Options: API.

API

String

Aggregate by

Defines the entity for aggregating the limits. Options: Consumer and Credential (API Key, Basic Auth).

Consumer

String

Options

Defines the limit of requests that can be made within a time interval.

N/A

Options of Rate Limit

Interval

Defines the time interval for the limit of requests. Options: second, minute, hour, day, and month.

second

String

Limit

Defines the maximum number of requests that users can make in the specified time interval.

N/A

Integer

Allow Redelivery Of Messages

If activated, the option allows messages to be redelivered in case of Pipeline Engine failure.

N/A

Boolean

There is a global configuration parameter that obliges all the pipelines to be published with at least the API Key or Basic Auth options enabled.

Parameters additional information

Add Cross-Origin Resource Sharing (CORS) - CORS Headers

We use a comma to enter multiple values in a header, but we don't add a space before or after the comma. Special characters should not be used in keys, due to possible failures in proxies and gateways.

Remove Digibee Prefix from Route

As previously explained, this option is recommended for removing the default Digibee route prefix from the pipeline route.

Let’s say you’ve created a pipeline and set the trigger as follows:

With the configurations applied and the pipeline deployed, you will get a new URL:

https://test.godigibee.io/products

When removing the default prefix and setting the pipeline route through the Additional API Routes parameter, be careful not to set an existing pipeline route used by other pipelines. In case you have more than one pipeline major version, it’s also important to keep in mind that the pipeline route versioning must be done by the user due to the absence of a versioning path parameter. For example: /pipeline/realm/v1/.

Rate Limit

When creating APIs, we usually want to limit the number of API requests users can make in a given time interval.

This action can be performed by activating the Rate Limit option and applying the following settings:

If the API has additional paths, the limit is shared among all paths. To apply the rate limit settings, the API must be configured with an API key or Basic Auth so that the Aggregate by parameter can be used by groups of credentials if the Consumer option is selected, or by an individual credential if the Credential option (API Key, Basic Auth) is selected.

If multiple interval parameters are configured with repeating values, only one of these values is considered. It’s also necessary that a value greater than zero be informed for the Limit parameter.

If the rate limiting options aren't set correctly, they'll be ignored and a warning log will be issued. You can view this log on the Pipeline Logs page.

HTTP File Trigger in action

Scenario: GET with any content type

Let's say you have a file with more than 5MB. You can call a pipeline endpoint configured with HTTP Trigger via GET with any content type for the request to be received and treated. The file is returned according to the output content type and its "as-is" content.

For that to happen, all you have to do is follow these steps:

  1. Create a pipeline and configure its trigger as HTTP-File, including the GET method and the accepted Response Content Types.

  2. Insert a File Connector in the pipeline to search the file to be enabled. You can, for example, configure WGet to obtain a file of a URL sent to the endpoint during a call.

  3. Insert JSON Generator as the last step of your pipeline so that a JSON is generated in the following format:

{ 
    "file": "file-download.pdf", 
    "Content-Type": "application/pdf"
}

This step is fundamental for HTTP File Trigger to understand that the file works.

4. Deploy the pipeline.

5. Create a consumer and configure it so that it has access to the pipeline.

6. Call the pipeline through this curl:

curl https://godigibee.io/pipeline/realm_name/v1/pipeline_name -v -H 'Content-Type: application/pdf' -H 'apikey: generated_token' -H 'urlDownload: http://url/path'
  • realm_name: refers to the realm where the pipeline is located.

  • generated_token: refers to the API Key generated by the recently created consumer.

  • urlDownload: parameter sent for WGet Connector to solve the value of the URL field. The attribute isn't mandatory but allows a more flexible approach through Double Braces. It works perfectly if you define the "path" directly in WGet Connector.

HTTP File Trigger Response

It's simple to define the pipeline response format. Add a Transformer to the end of the pipeline and define the response:

{  
    "file": "file-download.pdf",  
    "code": 200,  
    "Content-Type": "application/pdf"
}

Content-Type must be one of the values defined in Response Content Types.

HTTP File Trigger responds to bodies that aren't files in the same way HTTP Trigger does. It allows the pipeline to respond with the file or with any other content type according to the invocation context. For HTTP File Trigger to respond with any body, the last step of the pipeline must have this structure:

{ 
    "body": "information that will be written in the endpoint output", 
    "Content-Type": "body content type", 
    "code": <a HTTP return code>
}

Last updated