Skip to content

Get Document

The Get Document task fetches a document from a specified URL based on the provided media type. It supports different formats, ensuring the retrieval of various types of documents. The task initiates a GET request to the URL and retrieves the document in the specified format, which is then available for subsequent AI-driven tasks or data processing.

Task parameters

Configure these parameters for the Get Document task.

Parameter Description Required/ Optional
inputParameters.url The URL of the file to be retrieved. Required.
inputParameters.mediaType The media type of the file to be retrieved. Supported media types:
  • application/pdf
  • text/html
  • text/plain
  • application/json
Optional.

The following are generic configuration parameters that can be applied to the task and are not specific to the Get Document task.

Caching parameters

You can cache the task outputs using the following parameters. Refer to Caching Task Outputs for a full guide.

Parameter Description Required/ Optional
cacheConfig.ttlInSecond The time to live in seconds, which is the duration for the output to be cached. Required if using cacheConfig.
cacheConfig.key The cache key is a unique identifier for the cached output and must be constructed exclusively from the task’s input parameters.
It can be a string concatenation that contains the task’s input keys, such as ${uri}-${method} or re_${uri}_${method}.
Required if using cacheConfig.

Task configuration

This is the task configuration for a Get Document task.

{
  "name": "get_document_task",
  "taskReferenceName": "get_document_task_ref",
  "inputParameters": {
    "url": "${workflow.input.url}",
    "mediaType": "application/pdf"
  },
  "type": "GET_DOCUMENT"
}

Task output

The Get Document task will return the following parameters.

Parameter Description
result Extracted text from the document. The value is a string and can include newline escape characters (\n).

Examples

Here are some examples for using the Get Document task.

Using a Get Document task in a workflow

See an example of building a document classification workflow using the Get Document task.