AttachmentStorage Object
Details on how to upload files to the Xurrent attachment storage facility.
Various rich text fields in Xurrent can hold attachments. They may contain inline image or video files, and some of them can have attachments listed externally, in which case in the Xurrent UI these are displayed at the bottom of the text represented with a paperclip in front of each attachment.
Adding attachments and inline image or video files to rich text fields is a three-step process:
- Get access to the Xurrent storage facility (this type provides the necessary details)
- Upload the files
- Use the
keys obtained from the uploads asAttachmentInput.keyarguments.
Query to retrieve the required data:
query {
attachmentStorage {
sizeLimit
allowedExtensions
uploadUri
provider
providerParameters
}
}
An upload POST (to uploadUri) must use 'multipart/form-data' encoding
according to RFC 2388.
The upload must start with a field named Content-Type whose value is the correct content type of the file being uploaded.
Subsequently all providerParameters must be supplied and finally a field named file containing the
actual (binary) file content must be present.
When the provider is s3 the response to the upload will be XML, the Key element holds the value required
to be used in AttachmentInput arguments. It will look something like:
<?xml version="1.0"?>
<PostResponse>
<Location>https://xurrent.s3-accelerate.dualstack.amazonaws.com/attachments%2F5%2F2020%2F11%2F15%2F6%2F1605413834-431xxxc1be%%2Fhelloworld.txt</Location>
<Bucket>Xurrent</Bucket>
<Key>attachments/5/2020/11/15/6/1605413834-431xxxcc1be/helloworld.txt</Key>
<ETag>"9008d115b2d05a7ca6b495fd0cb998df"</ETag>
</PostResponse>
When the provider is local the response to the upload will be JSON, the key property holds the value required
to be used in AttachmentInput arguments. It will look something like:
{
"key": "attachments/5/.../helloworld.txt"
}
Fields
The fields in this section list which values can be retrieved when querying AttachmentStorage records.
[String!]!)
The permitted file extensions for uploads.
String!)
Type of storage facility in use. One of:
-
local: On-premise environment storage. -
s3: Cloud environment storage.
JSON!)
The mandatory fields and their values that should be added to an upload POST to the uploadUri.
Int!)
The maximum size (in bytes) for uploads.
String!)
The URI that attachments should be uploaded to.