Attachment Utilities
Attachment Utilities provides tools for transforming, extracting, and converting data from file attachments and URLs.
Attachment Utilities is a versatile toolkit for file extraction, conversion, and enrichment within the Swimlane Turbine platform. It enables users to automate the processing of attachmentsβsuch as converting files to and from Base64, extracting text or images, transforming spreadsheets to JSON, and downloading files from URLsβwithout writing code. By integrating Attachment Utilities, Swimlane Turbine users can streamline data ingestion, accelerate content analysis, and enhance the efficiency of security workflows through seamless file handling and enrichment capabilities.
Prerequisites
Capabilities
The Attachment Utils connector has the following capabilities:
- Convert a base64 string to an attachment type
- Convert an attachment to text
- Convert an attachment to base64
- Download File from URL
- Extract Text from Image (OCR)
- Extract Images from an HTML File
- Extract Images from a URL
- XLSX and CSV to JSON
Action Setup
Extract Text from Image (OCR)
- Page Segmentation Mode Values
0 Orientation and script detection (OSD) only.
1 Automatic page segmentation with OSD.
2 Automatic page segmentation, but no OSD, or OCR. (not implemented)
3 Fully automatic page segmentation, but no OSD. (Default)
4 Assume a single column of text of variable sizes.
5 Assume a single uniform block of vertically aligned text.
6 Assume a single uniform block of text.
7 Treat the image as a single text line.
8 Treat the image as a single word.
9 Treat the image as a single word in a circle.
10 Treat the image as a single character.
11 Sparse text. Find as much text as possible in no particular order.
12 Sparse text with OSD.
13 Raw line. Treat the image as a single text line,
bypassing hacks that are Tesseract-specific.- OCR Engine Mode Values
0 Legacy engine only.
1 Neural nets LSTM engine only.
2 Legacy + LSTM engines.
3 Default, based on what is available.Action Limitation
Extract Images from HTML
- This action can extract images from a HTML file only if full paths are available to image sources (i.e., something like http://<base_url>/<path_to_image>).
Actions
Attachment to Base64
Convert an attachment to a base64-encoded string using the provided attachments input and return the encoded result.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
attachments | array | Required | File to be uploaded |
attachments.file | string | Optional | Parameter for Attachment to Base64 |
attachments.file_name | string | Optional | Name of the resource |
attachments.description | string | Optional | Parameter for Attachment to Base64 |
Input Example
{"attachments":[{"file":"string","file_name":"Example Name","description":"string"}]}
Output
Parameter | Type | Description |
|---|---|---|
filename | string | Filename |
base64 | string | Base64 string. |
Output Example
{"filename":"string","base64":"string"}
Attachment to Text
Convert file attachments into plain text for content analysis and processing within the Swimlane platform using the provided attachments input.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
attachments | array | Required | File to be uploaded |
attachments.file | string | Optional | Parameter for Attachment to Text |
attachments.file_name | string | Optional | Name of the resource |
attachments.description | string | Optional | Parameter for Attachment to Text |
Input Example
{"attachments":[{"file":"string","file_name":"Example Name","description":"string"}]}
Output
Parameter | Type | Description |
|---|---|---|
filename | string | Filename |
text | string | Text |
Output Example
{"filename":"string","text":"string"}
Base64 to Attachment
Convert a Base64-encoded string into an attachment file using Attachment Utilities and return the generated file.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
filename | string | Optional | Filename |
base64 | string | Optional | Base64 encoded file |
Input Example
{"filename":"Example Name","base64":"string"}
Output
Parameter | Type | Description |
|---|---|---|
file | object | Attachments |
file.file | string | Output field: file.file |
file.file_name | string | Name of the resource |
Output Example
{"file":{"file":"string","file_name":"Example Name"}}
Download file from URL
Download a file from a specified URL for use or processing within the Swimlane platform by providing the required URL.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | URL endpoint for the request |
file_name | string | Optional | The name of the file to be downloaded. If not provided, a default name will be used. |
verify_ssl | boolean | Optional | Verify SSL certificate. |
http_proxy | string | Optional | A proxy to route requests through. |
Input Example
{"url":"https://example.com/api/resource","file_name":"Example Name","verify_ssl":true,"http_proxy":"string"}
Output
Parameter | Type | Description |
|---|---|---|
file | object | Attachments |
file.file | string | Output field: file.file |
file.file_name | string | Name of the resource |
Output Example
{"file":{"file":"string","file_name":"Example Name"}}
Extract Images from HTML File
Extract images from an HTML file attachment and prepare them for analysis or storage using the provided attachments.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
attachments | array | Required | File to be uploaded |
attachments.file | string | Optional | Parameter for Extract Images from HTML File |
attachments.file_name | string | Optional | Name of the resource |
attachments.description | string | Optional | Parameter for Extract Images from HTML File |
verify_ssl | boolean | Optional | Verify SSL certificate |
http_proxy | string | Optional | A proxy to route requests through. |
Input Example
{"attachments":[{"file":"string","file_name":"Example Name","description":"string"}],"verify_ssl":true,"http_proxy":"string"}
Output
Parameter | Type | Description |
|---|---|---|
file | array | Extracted Images. |
file.file | string | Output field: file.file |
file.file_name | string | Name of the resource |
Output Example
{"file":[]}
Extract Images from URL
Retrieve all images found in the HTML content of a specified URL for efficient extraction and further analysis.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | URL endpoint for the request |
verify_ssl | boolean | Optional | Verify SSL certificate. |
http_proxy | string | Optional | A proxy to route requests through. |
Input Example
{"url":"https://example.com/api/resource","verify_ssl":true,"http_proxy":"string"}
Output
Parameter | Type | Description |
|---|---|---|
file | array | Extracted Images. |
file.file | string | Output field: file.file |
file.file_name | string | Name of the resource |
Output Example
{"file":[]}
Extract Text from Image (OCR)
Extract text content from image file attachments for analysis or further processing within Attachment Utilities.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
attachments | array | Required | File to be uploaded |
attachments.file | string | Optional | Parameter for Extract Text from Image (OCR) |
attachments.file_name | string | Optional | Name of the resource |
attachments.description | string | Optional | Parameter for Extract Text from Image (OCR) |
languages | array | Optional | Languags of the text to be extracted. Default - eng. |
psm | number | Optional | Control the automatic Page Segmentation Mode used by Tesseract. |
oem | number | Optional | Controls the type of algorithm used by Tesseract. |
timeout | number | Optional | Duration in seconds for the OCR processing, after which, pytesseract will terminate and raise RuntimeError. |
nice | number | Optional | Modifies the processor priority for the Tesseract run. Nice adjusts the niceness of unix-like processes. |
Input Example
{"attachments":[{"file":"string","file_name":"Example Name","description":"string"}],"languages":["string"],"psm":123,"oem":123,"timeout":123,"nice":123}
Output
Parameter | Type | Description |
|---|---|---|
filename | string | Name of the resource |
extracted_text | string | Output field: extracted_text |
Output Example
{"filename":"string","extracted_text":"string"}
XLSX and CSV to JSON
Transform XLSX and CSV file attachments into JSON format for streamlined data manipulation and integration with other services.
Endpoint
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
attachments | array | Required | File to be uploaded |
attachments.file | string | Optional | Parameter for XLSX and CSV to JSON |
attachments.file_name | string | Optional | Name of the resource |
attachments.description | string | Optional | Parameter for XLSX and CSV to JSON |
Input Example
{"attachments":[{"file":"string","file_name":"Example Name","description":"string"}]}
Output
Parameter | Type | Description |
|---|---|---|
json | array | Output field: json |
Output Example
{"json":[]}
Response Headers
Header | Description | Example |
|---|---|---|
Content-Type | The media type of the resource | application/json |
Date | The date and time at which the message was originated | Thu, 01 Jan 2024 00:00:00 GMT |