You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attachments need to be uploaded to the Groupware API and then referenced in the Email (draft) object through its blobId (which you get back from the Groupware API.)
Metadata about the attachment, notably the MIME type, must be indicated in the Email object where the blobId is referenced.
(Where type is just the same as the Content-Type that was set in the request header, JMAP blobs don't actually have any associated metadata -- see below.)
For example:
oc-gw POST /groupware/accounts/_/blobs Content-Type:image/png < ./opencloud_logo.png
Binary data is referenced by a blobId in JMAP and uploaded/downloaded separately to the core API. The blobId solely represents the raw bytes of data, not any associated metadata such as a file name or content type. Such metadata is stored alongside the blobId in the object referencing it. The data represented by a blobId is immutable.
[...]
A blob that is not referenced by a JMAP object (e.g., as a message attachment) MAY be deleted by the server to free up resources. Uploads (see below) are initially unreferenced blobs. To ensure interoperability:
The server SHOULD use a separate quota for unreferenced blobs to the account's usual quota. In the case of shared accounts, this quota SHOULD be separate per user.
This quota SHOULD be at least the maximum total size that a single object can reference on this server. For example, if supporting JMAP Mail, this should be at least the maximum total attachments size for a message.
When an upload would take the user over quota, the server MUST delete unreferenced blobs in date order, oldest first, until there is room for the new blob.
Except where quota restrictions force early deletion, an unreferenced blob MUST NOT be deleted for at least 1 hour from the time of upload; if reuploaded, the same blobId MAY be returned, but this SHOULD reset the expiry time.
A blob MUST NOT be deleted during the method call that removed the last reference, so that a client can issue a create and a destroy that both reference the blob within the same method call.
Activity
pbleser-oc commentedon Nov 17, 2025
Attachments need to be uploaded to the Groupware API and then referenced in the Email (draft) object through its
blobId(which you get back from the Groupware API.)Metadata about the attachment, notably the MIME type, must be indicated in the Email object where the
blobIdis referenced.API to upload a blob:
POST /groupware/accounts/{accountId}/blobs(added with opencloud-eu/opencloud@0bf485e)
The request may set the
Content-Typeheader if possible.It returns the following JSON response:
{ "blobId": "...", "size": 12345, "type": "application/pdf" }(Where
typeis just the same as theContent-Typethat was set in the request header, JMAP blobs don't actually have any associated metadata -- see below.)For example:
oc-gw POST /groupware/accounts/_/blobs Content-Type:image/png < ./opencloud_logo.pngyields this response:
{ "blobId": "ecfpcnaf1awj0dex3t9u0ourvx17cwzxna9effbj7ohat90u01pc7aoputwmqbq", "size": 12762, "type": "image/png" }Those attachments are then referenced in the Email (draft) object, like this:
{ ... "attachments": [ { "blobId": "ecfpcnaf1awj0dex3t9u0ourvx17cwzxna9effbj7ohat90u01pc7aoputwmqbq", "name": "opencloud_logo.png", "type": "image/png", "disposition": "attachment" } ], ... }Notice the separation of
blobIdname) and MIME type (type), that are in the attachment object in the Email instead, together with thatblobIdNote that there is no API to delete or update/replace blobs, as they are immutable and garbage collected by the server.
It is however possible to "drop" an attachment, simply be removing the corresponding attachment object from the
attachmentsarray in the Email object:blobIdattachmentsproperty, putting thatblobIdin there, along with the filename and MIME typeattachmentspropertyFor reference, and on that garbage collection: the JMAP Core specification mentions:
Binary data is referenced by a
blobIdin JMAP and uploaded/downloaded separately to the core API. TheblobIdsolely represents the raw bytes of data, not any associated metadata such as a file name or content type. Such metadata is stored alongside theblobIdin the object referencing it. The data represented by ablobIdis immutable.[...]
A blob that is not referenced by a JMAP object (e.g., as a message attachment) MAY be deleted by the server to free up resources. Uploads (see below) are initially unreferenced blobs. To ensure interoperability:
blobIdMAY be returned, but this SHOULD reset the expiry time.