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)

In HTTP, multipart requests are used to send multiple types of data in a single request – generally structured text and unstructured binary data. This often boils down to sending JSON or XML data alongside files. In Appian, choosing the Multipart Form Data Content Type option allows you to configure such a request. The list below provides details on configuring multipart requests in Appian. For more information on multipart requests in general, see the RFC.

Additional Considerations

  • On choosing the Multipart Form Data Content Type option, one form part is automatically added. Any number of static form parts can be sent. You cannot configure a dynamic number of form parts.
  • Each form part has a static "name" and content type along with a dynamic value. You cannot configure dynamic form part names or content types.
  • 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.

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