Fetch a file
Function: Fetch a file
Effortlessly connect and fetch a file, simplifying data integration and enhancing the functionality of your applications through a user-friendly, code-free interface. This action allows your application to retrieve files from external web services or APIs.
Input
- Authentication method: Specify how your application will prove its identity to the external service.
- Options:
Basic authentication: Uses a username and password.Bearer Token: Uses a special token in the request header.API Token: Uses an API key in the request header.None: No authentication is used.
- Options:
- Username: (Visible if "Basic authentication" is selected) The username for basic authentication.
- Password: (Visible if "Basic authentication" is selected) The password for basic authentication.
- Token: (Visible if "Bearer Token" or "API Token" is selected) The secret token or API key for authentication.
- Headers: A collection of key-value pairs to send as custom headers with your request. This is useful for providing additional information to the server.
- Endpoint: The complete web address (URL) of the file you want to fetch. This is a required input.
- Query parameters: A collection of key-value pairs to add to the end of the URL, often used for filtering or specifying data.
- Method: The type of request your application will make to the external service. This is a required input.
- Options:
GET: Used to retrieve data. (Default)POST: Used to send data to the server, typically to create or update a resource.
- Options:
- Request body: (Visible if "POST" method is selected) A collection of key-value pairs representing the data you want to send to the external service.
- File name: The name you want to give to the downloaded file within your application. If not provided, it defaults to "downloaded_file".
- File description: A brief explanation or note about the downloaded file.
Output
- Response: A variable that will hold the downloaded file. This file can then be used in other parts of your application.
- Status: A variable that will indicate the outcome of the API call.
SUCCESS: The file was fetched successfully.NOT_FOUND: The specified endpoint (URL) could not be found on the remote service.UNAUTHORIZED: The provided authentication credentials were not accepted.BAD_REQUEST: The request sent to the API was invalid (e.g., missing required data in the body).TYPE_ERROR: An error occurred while trying to determine the file type.
Execution Flow
Real-Life Examples
Example 1: Downloading a Public Report
Imagine you need to regularly download a public sales report from a government website. This report doesn't require any special login.
- Inputs:
- Authentication method:
None - Endpoint:
https://www.example.gov/reports/sales_data_q3_2023.pdf - Method:
GET - File name:
Q3_Sales_Report - File description:
Quarter 3 Sales Data from Government
- Authentication method:
- Result: The PDF report
sales_data_q3_2023.pdfis downloaded and stored in your application as a file namedQ3_Sales_Reportin theResponsevariable. TheStatusvariable will be set toSUCCESS.
Example 2: Fetching an Invoice from an Accounting System
Your application needs to retrieve a specific invoice from an external accounting system that uses an API key for secure access.
- Inputs:
- Authentication method:
API Token - Token:
your_secret_api_key_12345 - Endpoint:
https://api.accounting.com/invoices/download - Query parameters:
invoiceId:INV-2023-001format:json
- Method:
GET - File name:
Invoice_INV-2023-001 - File description:
Invoice details for customer ABC
- Authentication method:
- Result: The JSON file containing the invoice details for
INV-2023-001is downloaded and saved asInvoice_INV-2023-001in theResponsevariable. TheStatusvariable will be set toSUCCESS. If the API key was incorrect,Statuswould beUNAUTHORIZED.
Example 3: Submitting a Request and Receiving a Generated Document
You have a form in your application where users request a custom certificate. After the user submits the form, your application calls an external service to generate the certificate and then downloads it. This service requires a username and password and expects the request details in the body.
- Inputs:
- Authentication method:
Basic authentication - Username:
cert_generator_user - Password:
secure_password_123 - Endpoint:
https://cert-service.com/generate - Method:
POST - Request body:
userName:John DoecourseName:Advanced No-Code DevelopmentdateCompleted:2023-10-26
- File name:
John_Doe_Certificate - File description:
Certificate for John Doe
- Authentication method:
- Result: The external service generates a certificate based on the provided details. This certificate (e.g., a PDF) is then downloaded and stored in your application as
John_Doe_Certificatein theResponsevariable. TheStatusvariable will beSUCCESS. If the request body was malformed,Statuswould beBAD_REQUEST.