Request File
Category: External Services
Description: This extension module allows you to request, modify, and delete files from a server, provided you have the necessary permissions, or to obtain them through Azure File Shares.
Functionality: This extension module has two functional alternatives. On one hand, it allows you to request a file available on an internet service through its URL and HTTP methods, where you will input the necessary information for the correct execution of the methods. There will be a timeout for the response to the request before considering it failed. On the other hand, you can obtain a file available in Azure File Shares, corresponding to the Azure Storage service.
Prerequisites
To use the option in the module for uploading a file available in Azure, the following is required:
- Azure Account: Have an active Azure account. If not, create one. Access the Azure Portal.
- Azure Storage Account: Within your Azure subscription, create a storage account. This account will be where the Azure File Share is hosted (Storage Accounts > Create > [Fill in the configuration fields]).
- Create an Azure File Share: Within the storage account, create a File Share (File Shares > Create > [Specify a name and maximum size]).
- Connection String or File Share URL: These are necessary to access and mount the resource. The Connection String is obtained from the storage account settings, and the URL is generated within the File Share.
Implementation
This module consists of several parameter request fields, grouped into three sections according to their specific functionality. Two groups, General and File Download Options, are displayed by default when starting the module configuration. A third group changes according to the option selected in the File Download Options group, which can be Azure File Shares or Request
Name: String input field that identifies an extension module in the flow.
General
The name of the entity where the result will be stored, obtained from an expression: String Expression field where you enter the name of the entity in which the responses to the requests made will be stored.
If the maximum number of failed attempts is reached, the action flow will be interrupted, and the error description will be passed to the selected intent with the name: 'Request_File_error': Input field that allows selecting from a dropdown list the intent to handle errors for this extension module (after configuration); error details will be available in the entity named Request_File_error.
File Download Options
Source from which the file is downloaded: Input field that allows you to select between the options Request or Azure File Shares from a dropdown list, depending on the location of the file you want to use. The Request option allows you to specify the URL of a file accessible by request, while the Azure File Shares option refers to the service available in Azure Storage for file sharing.
Request
HTTP Methods: String input field in the form of a dropdown list where the HTTP method to execute is selected. These methods are standard actions indicating the operation to be performed on a specific resource. Each method has a defined purpose and determines how the server should interpret the request.
- GET: Requests data from a specific resource on a server.
- POST: Sends data to a server to be processed. It can result in side effects such as creating a new resource or updating an existing one.
- PUT: Replaces all current representations of the target resource with the data sent in the request.
- PATCH: Applies partial modifications to a resource.
- DELETE: Deletes the specified resource.
- HEAD: Requests a response similar to a GET request but without the response body.
- OPTIONS: Returns the HTTP methods that the server supports for the specified URL, along with other metadata.
The URL to invoke obtained from an expression: Input field of type String Expression that allows entering the URL to access for the request, or the name of a previously created String entity containing the URL.
Specifies a collection of the name/value pairs that make up the HTTP headers. The Value will be evaluated as an expression: String Expression input field to enter the name and value that will form the HTTP header. These headers enable effective communication between clients and servers, providing details such as the content type being sent or received, content length, required authentication type, language preferences, among others.
The number of milliseconds to wait before the request timeout. The default value is 30,000 milliseconds (30 seconds), obtained from an expression: Integer Expression field to enter the maximum time in milliseconds that a client waits to receive a response from the server before considering the request failed due to a timeout. By default, if an explicit timeout is not specified in the request configuration, it will wait for 30 seconds before automatically canceling the request because the server has not responded within that period.
Body to send obtained from an expression: String input field allows entering the request body or an entity containing the request body. This refers to the part of the request containing the data sent to the server or the data the server sends back to the client; especially relevant in request methods like POST, PUT, PATCH, and sometimes DELETE, where additional data is commonly sent along with the request.
Types of data in the request body:
- HTML Forms: Usually sent with content type application/x-www-form-urlencoded.
- JSON: Common in RESTful APIs, used with content type application/json.
- XML: Less common in modern applications, used with content type application/xml.
- Binary Files: Such as images, videos, etc., sent with specific content types like image/jpeg, video/mp4, etc.
Azure file shares
It is a cloud file storage service that is part of Azure Storage. It allows applications to share files using standard protocols such as SMB (Server Message Block), providing an experience similar to that of a traditional file system.
For configuring this option, the required fields are:
Connection String: Input field of type password for entering the Connection String, available at Storage account > Security + Networking > Access keys > Connection string. The Connection String contains the information needed for Lynn, through the extension module, to communicate with the storage account in Azure.
File Share Name: Input field of type String Expression for entering the name of the folder, or an entity that contains the folder name, within File Shares that contains the file to be requested.
File Name: Input field of type String Expression for entering the name and extension of the file, or an entity that contains this information, to be requested from Azure File Shares.
File Type: Input field of type String Expression for entering the file type, or an entity that contains this information, to be requested (e.g., .docx, .pdf, .txt, .jpg, among others).