Integration Content Types

When configuring an HTTP integration with a body, you must choose a value in the Content Type dropdown. In all cases, this dropdown will set the "Content-Type" header on your request. The sections below provide more information on the individual content types and what they mean in the context of the integration.

The Document and Multipart Form Data Content Types can be used to send binary documents with your integrations

JSON (application/json)

JavaScript Object Notation (JSON) is a lightweight data-interchange format that is commonly used for RESTful web services. It is structured as an array of objects where an object is a collection of name/value pairs. In many ways, JSON objects are similar to Appian dictionaries. When selecting this value for your Content Type, you need manually convert Appian data to JSON. To convert Appian values to JSON, use a!toJson(). You should not use this content type when sending primitive types.

XML (application/xml)

eXtensible Markup Language (XML) is a data-interchange format that is commonly used for SOAP web services, though it is also compatible with REST. It is composed of nested units called elements that form data structures similar to Appian dictionaries and complex data types. When selecting this value for your Content Type, you need to manually convert Appian data to XML. To convert an Appian value to XML, use toxml(). In general, you should not use this content type when sending primitive types.

Document (auto-detect)

The Document Content Type option allows you to send files to external systems. Choosing this option affects your request in three ways:

  1. Appian sets the Content-Type header. The media type in parenthesis is "auto-detect" because Appian will automatically detect the correct media type based on the content of the chosen document and the document's extension.
  2. Appian casts the body or part value to an Appian document whose content type will be detected. This step follows standard Appian casting rules.
  3. Appian sends the content of the Appian document as the body or part of the request instead of the document ID. This allows you to upload files to external systems, such as Google Drive or Microsoft SharePoint®. The file contents are streamed from the file system to the external service, meaning the file is never fully read into memory. As a result, it is safe to send large files to external systems using this functionality.

Multipart Form Data (multipart/form-data)

Some services require data to be sent as multipart/form-data. This is typical for services that upload documents. Multipart HTTP requests can send multiple types of data in a single request, such as structured text and unstructured binary data. For example, sending JSON or XML data (structured text) along with files (unstructured binary data). In Appian, choosing the Multipart Form Data (multipart/form-data) for the Content Type allows you to configure this type of request. For more information on multipart requests in general, see the RFC.

Sending documents

Documents can be sent as form part values. See the above section for more details on sending documents.

Document parts are sent differently than non-document parts. Unlike non-document parts, document parts are never fully stored in memory, making it safe to send large files through a multipart request.

Limits

You can send as many form parts as you want. However, there is a limit of 75 MB per request. This means you can send one 75 MB file, or three 25 MB files, but you cannot exceed 75 MB across all files that are being sent.

Configuring form parts

If you have a static number of form parts that don't require additional logic, select Specify data for each part and use the form to specify the fields.

Multipart Form Data Specify Values

You can also use an expression to define the form parts by selecting Define all parts with a single expression. This can be helpful if you need conditional logic, such as sending optional files. See a!httpFormPart() for more information on setting up the expression.

Text (text/plain)

Choosing this option sets the Content-Type header text/plain, which is the generic media type for plain text. This content type is rarely used by APIs.

Custom

Selecting the Custom option allows you to set content-type manually. This should be used when you cannot leverage any of the provided content-type options. Note that only text-based media types can be sent through integrations in this way, and the charset will automatically be set to UTF-8.

FEEDBACK