@ExperimentalApi
public interface AttachmentService
Content objects.| Modifier and Type | Interface and Description | 
|---|---|
| static interface  | AttachmentService.AttachmentFinderA finder for locating attachments. | 
| static interface  | AttachmentService.ValidatorProvides methods for validating the actions on the AttachmentService | 
| Modifier and Type | Field and Description | 
|---|---|
| static String | COMMENT_METADATA_KEYAttachment Comments are stored in the  Contentmetadata as the "comment" entry. | 
| static String | FILE_SIZEAttachment file size is stored in the  Contentas the "fileSize" extension property. | 
| static String | LABELS_METADATA_KEYAttachment Labels is stored in the  Contentmetadata as the "labels" entry. | 
| static String | MEDIA_TYPE_METADATA_KEYAttachment Media Type is stored in the  Contentmetadata as the "mediaType" entry. | 
| Modifier and Type | Method and Description | 
|---|---|
| PageResponse<Content> | addAttachments(ContentId containerId,
              Collection<AttachmentUpload> uploads)Add one or more attachments to a piece of  Content. | 
| PageResponse<Content> | addAttachments(ContentId containerId,
              ContentStatus containerStatus,
              Collection<AttachmentUpload> uploads)Add one or more attachments to a piece of  Content. | 
| PageResponse<Content> | addAttachments(ContentId containerId,
              ContentStatus containerStatus,
              Collection<AttachmentUpload> uploads,
              boolean allowDuplicated,
              Expansions expansions)Add one or more attachments to a piece of  Content. | 
| void | delete(Content attachment)Moves an Attachment to trash. | 
| AttachmentService.AttachmentFinder | find(Expansion... expansions)Creates an attachment finder for locating attachments. | 
| Content | update(Content attachment)Updates the non-data parts of an Attachment  Contentinstance. | 
| Content | updateData(ContentId attachmentId,
          AttachmentUpload upload)Updates the data part of an Attachment  Contentinstance. | 
| AttachmentService.Validator | validator()Provides a validator for validating actions on the AttachmentService and checking permissions
 related to attachments on Content | 
static final String COMMENT_METADATA_KEY
Content metadata as the "comment" entry.static final String MEDIA_TYPE_METADATA_KEY
Content metadata as the "mediaType" entry.static final String LABELS_METADATA_KEY
Content metadata as the "labels" entry.static final String FILE_SIZE
Content as the "fileSize" extension property.PageResponse<Content> addAttachments(ContentId containerId, Collection<AttachmentUpload> uploads) throws ServiceException
Content.containerId - the id of the content to attach touploads - the attachments being uploadedServiceExceptionPageResponse<Content> addAttachments(ContentId containerId, ContentStatus containerStatus, Collection<AttachmentUpload> uploads) throws ServiceException
Content.containerId - the id of the content to attach tocontainerStatus - the status of the container, specifically allows adding attachments to draftsuploads - the attachments being uploadedServiceExceptionPageResponse<Content> addAttachments(ContentId containerId, ContentStatus containerStatus, Collection<AttachmentUpload> uploads, boolean allowDuplicated, Expansions expansions) throws ServiceException
Content.containerId - the id of the content to attach tocontainerStatus - the status of the container, specifically allows adding attachments to draftsuploads - the attachments being uploadedexpansions - the expansions to apply to the values returned after uploadedServiceExceptionAttachmentService.AttachmentFinder find(Expansion... expansions)
Currently an attachment finder requires a Content container id, unless the attachment is being requested by its id via the "withId" method.
For example, to locate an attachment in a given page with a particular filename:
 
 Content attachment = attachmentService.find()
      .withContainerId(pageId)
      .withFilename("myfile.txt")
      .fetchOneOrNull();
 
 expansions - the expansions to apply to the values returned from a fetchContent update(Content attachment) throws ServiceException
Content instance.
 This method can be used to update the container, filename, media-type and comment of an Attachment.
attachment - the attachment to update, must include an idServiceExceptionContent updateData(ContentId attachmentId, AttachmentUpload upload) throws ServiceException
Content instance.attachmentId - the id of the attachment to updateupload - the new content of the AttachmentServiceExceptionAttachmentService.Validator validator()
void delete(Content attachment) throws ServiceException
attachment - the content to trashServiceException - if the content cannot be found, or cannot be deletedCopyright © 2003–2022 Atlassian. All rights reserved.