attachmentService

A web service for managing attachment settings. Much of this service corresponds to functionality in the admin console page at System > Settings > Attachments.

There are three main properties that can administered with respect to attachments:

Method Description
addAllowedType Adds a content type to the list of explicitly allowed types.
addDisallowedType Adds a content type to the list of explicitly disallowed types.
getAllowedTypes Returns a list of all explicitly allowed types.
getDisallowedTypes Returns a list of explicitly disallowed types.
getImagePreviewMaxSize Returns the maximum dimension of generated thumbnails (the maximum value for the width or height).
getMaxAttachmentSize Returns the maximum size of an individual attachment in kilobytes.
getMaxAttachmentsPerBlogPost Returns the maximum number of attachments a blog post can have.
getMaxAttachmentsPerDocument Returns the maximum number of attachments that a document can have.
getMaxAttachmentsPerMessage Returns the maximum number of attachments per discussion message.
isAllowAllByDefault Returns true if the application is configured to "allow all content types by default."
isAttachmentsEnabled Returns true if attachments are enabled; false otherwise.
isImagePreviewEnabled Returns true if image preview support is enabled.
isImagePreviewRatioEnabled Returns true if the aspect ratio of thumbnails should be preserved.
isValidType Returns true if the specified content type is valid.
removeAllowedType Removes a content type from the list of explicitly allowed types.
removeDisallowedType Removes a content type from the list of explicitly disallowed types.
setAllowAllByDefault Sets the default allowed content types mode.
setAttachmentsEnabled Enables or disables attachments.
setImagePreviewEnabled Sets whether image preview support is enabled.
setImagePreviewMaxSize Sets the maximum dimension of generated thumbnails (the maximum value for the width or height).
setImagePreviewRatioEnabled Sets whether the aspect ratio of thumbnails should be preserved.
setMaxAttachmentSize Sets the maximum size of an individual attachment in kilobytes.
setMaxAttachmentsPerBlogPost Sets the maximum number of attachments blog post can have.
setMaxAttachmentsPerDocument Sets the maximum number of attachments that a document can have.
setMaxAttachmentsPerMessage Sets the maximum number of attachments per discussion message.

addAllowedType

Adds a content type to the list of explicitly allowed types.

POST http://domain:port/application_context/rpc/rest/attachmentService/allowedTypes

Arguments

Name Type Description
contentType xs:string The content type to add to the explicitly allowed types list.

Arguments Template

<addAllowedType> 
    <contentType>xs:string</contentType>
</addAllowedType>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

addDisallowedType

Adds a content type to the list of explicitly disallowed types.

POST http://domain:port/application_context/rpc/rest/attachmentService/disallowedTypes

Arguments

Name Type Description
contentType xs:string The content type to add to the explicitly disallowed types list.

Arguments Template

<addDisallowedType> 
    <contentType>xs:string</contentType>
</addDisallowedType>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

getAllowedTypes

Returns a list of all explicitly allowed types.

GET http://domain:port/application_context/rpc/rest/attachmentService/allowedTypes

Response

Type Description
List of A list of explicitly allowed types.

Response Template

<getAllowedTypesResponse> 
    <!-- List of ... -->
    <return>xs:string</return>
</getAllowedTypesResponse>

getDisallowedTypes

Returns a list of explicitly disallowed types.

GET http://domain:port/application_context/rpc/rest/attachmentService/disallowedTypes

Response

Type Description
List of A list of all explicitly disallowed types.

Response Template

<getDisallowedTypesResponse> 
    <!-- List of ... -->
    <return>xs:string</return>
</getDisallowedTypesResponse>

getImagePreviewMaxSize

Returns the maximum dimension of generated thumbnails (the maximum value for the width or height). The default value is 25.

GET http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewMaxSize

Response

Type Description
xs:int The maximum dimension of a thumbnail.

Response Template

<getImagePreviewMaxSizeResponse> 
    <return>xs:int</return>
</getImagePreviewMaxSizeResponse>

getMaxAttachmentSize

Returns the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the maximum size will fail with an exception. The default maximum attachment size is 1 MB, or 1,024 KB.

GET http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentSize

Response

Type Description
xs:int The maximum size in kilobytes of any single attachment.

Response Template

<getMaxAttachmentSizeResponse> 
    <return>xs:int</return>
</getMaxAttachmentSizeResponse>

getMaxAttachmentsPerBlogPost

Returns the maximum number of attachments a blog post can have. The default is 5 attachments.

GET http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerBlogPost

Response

Type Description
xs:int The maximum number of attachments allowed per blog post.

Response Template

<getMaxAttachmentsPerBlogPostResponse> 
    <return>xs:int</return>
</getMaxAttachmentsPerBlogPostResponse>

getMaxAttachmentsPerDocument

Returns the maximum number of attachments that a document can have. The default is 5.

GET http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerDoc

Response

Type Description
xs:int The maximum number of attachments allowed per document.

Response Template

<getMaxAttachmentsPerDocumentResponse> 
    <return>xs:int</return>
</getMaxAttachmentsPerDocumentResponse>

getMaxAttachmentsPerMessage

Returns the maximum number of attachments per discussion message. The default is 5 attachments.

GET http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerMessage

Response

Type Description
xs:int The maximum number of attachments allowed per discussion message.

Response Template

<getMaxAttachmentsPerMessageResponse> 
    <return>xs:int</return>
</getMaxAttachmentsPerMessageResponse>

isAllowAllByDefault

Returns true if the application is configured to "allow all content types by default." The alternative is that all content types are disallowed unless they're on the "allowed" list.

GET http://domain:port/application_context/rpc/rest/attachmentService/allowAllByDefault

Response

Type Description
xs:boolean true if all content types are allowed by default.

Response Template

<isAllowAllByDefaultResponse> 
    <return>xs:boolean</return>
</isAllowAllByDefaultResponse>

isAttachmentsEnabled

Returns true if attachments are enabled; false otherwise.

GET http://domain:port/application_context/rpc/rest/attachmentService/attachmentsEnabled

Response

Type Description
xs:boolean true if attachments are enabled; false otherwise.

Response Template

<isAttachmentsEnabledResponse> 
    <return>xs:boolean</return>
</isAttachmentsEnabledResponse>

isImagePreviewEnabled

Returns true if image preview support is enabled. When enabled, the application will generate thumbnails for image attachments. False by default.

GET http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewEnabled

Response

Type Description
xs:boolean true if thumbnail support is enabled.

Response Template

<isImagePreviewEnabledResponse> 
    <return>xs:boolean</return>
</isImagePreviewEnabledResponse>

isImagePreviewRatioEnabled

Returns true if the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true.

GET http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewRatioEnabled

Response

Type Description
xs:boolean true if the aspect ration should be preserved.

Response Template

<isImagePreviewRatioEnabledResponse> 
    <return>xs:boolean</return>
</isImagePreviewRatioEnabledResponse>

isValidType

Returns true if the specified content type is valid. This is based on the current settings of the allowAllByDefault flag and the allowed and disallowed types list.

GET http://domain:port/application_context/rpc/rest/attachmentService/allowedTypes/{contentType}

Arguments

Name Type Description
contentType xs:string The content type to test.

Arguments Template

<isValidType> 
    <contentType>xs:string</contentType>
</isValidType>

Response

Type Description
xs:boolean true if the content type is valid.

Response Template

<isValidTypeResponse> 
    <return>xs:boolean</return>
</isValidTypeResponse>

removeAllowedType

Removes a content type from the list of explicitly allowed types. If the specified content type does not exist in the list, this method does nothing.

DELETE http://domain:port/application_context/rpc/rest/attachmentService/allowedTypes/{contentType}

Arguments

Name Type Description
contentType xs:string The content type to remove from the explicitly allowed types list.

Arguments Template

<removeAllowedType> 
    <contentType>xs:string</contentType>
</removeAllowedType>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

removeDisallowedType

Removes a content type from the list of explicitly disallowed types.

DELETE http://domain:port/application_context/rpc/rest/attachmentService/disallowedTypes/{contentType}

Arguments

Name Type Description
contentType xs:string The content type to remove from the explicitly disallowed types list.

Arguments Template

<removeDisallowedType> 
    <contentType>xs:string</contentType>
</removeDisallowedType>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setAllowAllByDefault

Sets the default allowed content types mode. The value true means that all content types will be allowed unless they're on the "disallowed list". If false, no content types will be allowed unless on the "allowed list".

POST http://domain:port/application_context/rpc/rest/attachmentService/allowAllByDefault

Arguments

Name Type Description
allowAllByDefault xs:boolean true if all content types should be allowed by default.

Arguments Template

<setAllowAllByDefault> 
    <allowAllByDefault>xs:boolean</allowAllByDefault>
</setAllowAllByDefault>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setAttachmentsEnabled

Enables or disables attachments.

POST http://domain:port/application_context/rpc/rest/attachmentService/attachmentsEnabled

Arguments

Name Type Description
attachmentsEnabled xs:boolean true to enable attachments; false to disable them.

Arguments Template

<setAttachmentsEnabled> 
    <attachmentsEnabled>xs:boolean</attachmentsEnabled>
</setAttachmentsEnabled>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setImagePreviewEnabled

Sets whether image preview support is enabled. When enabled, the application will generate thumbnails for image attachments. False by default.

POST http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewEnabled

Arguments

Name Type Description
imagePreviewEnabled xs:boolean true to enable thumbnail support.

Arguments Template

<setImagePreviewEnabled> 
    <imagePreviewEnabled>xs:boolean</imagePreviewEnabled>
</setImagePreviewEnabled>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setImagePreviewMaxSize

Sets the maximum dimension of generated thumbnails (the maximum value for the width or height). The default value is 25.

POST http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewMaxSize

Arguments

Name Type Description
imagePreviewMaxSize xs:int The maximum dimension of a thumbnail.

Arguments Template

<setImagePreviewMaxSize> 
    <imagePreviewMaxSize>xs:int</imagePreviewMaxSize>
</setImagePreviewMaxSize>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setImagePreviewRatioEnabled

Sets whether the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true.

POST http://domain:port/application_context/rpc/rest/attachmentService/imagePreviewRatioEnabled

Arguments

Name Type Description
imagePreviewRatioEnabled xs:boolean true if the aspect ration should be preserved.

Arguments Template

<setImagePreviewRatioEnabled> 
    <imagePreviewRatioEnabled>xs:boolean</imagePreviewRatioEnabled>
</setImagePreviewRatioEnabled>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setMaxAttachmentSize

Sets the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the max size will fail with an exception. The default maximum attachment size is 1 MB, or 1024 KB.

POST http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentSize

Arguments

Name Type Description
maxAttachmentSize xs:int The maximum size in kilobytes of any single attachment.

Arguments Template

<setMaxAttachmentSize> 
    <maxAttachmentSize>xs:int</maxAttachmentSize>
</setMaxAttachmentSize>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setMaxAttachmentsPerBlogPost

Sets the maximum number of attachments blog post can have. The default is 5 attachments.

POST http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerBlogPost

Arguments

Name Type Description
maxAttachmentsPerBlogPost xs:int The maximum number of attachments allowed per blog post.

Arguments Template

<setMaxAttachmentsPerBlogPost> 
    <maxAttachmentsPerBlogPost>xs:int</maxAttachmentsPerBlogPost>
</setMaxAttachmentsPerBlogPost>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setMaxAttachmentsPerDocument

Sets the maximum number of attachments that a document can have. The default is 5 attachments.

POST http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerDocument

Arguments

Name Type Description
maxAttachmentsPerDocument xs:int The maximum number of attachments allowed per document.

Arguments Template

<setMaxAttachmentsPerDocument> 
    <maxAttachmentsPerDocument>xs:int</maxAttachmentsPerDocument>
</setMaxAttachmentsPerDocument>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.

setMaxAttachmentsPerMessage

Sets the maximum number of attachments per discussion message. The default is 5 attachments.

POST http://domain:port/application_context/rpc/rest/attachmentService/maxAttachmentsPerMessage

Arguments

Name Type Description
maxAttachmentsPerMessage xs:int The maximum number of attachments allowed per dicussion message.

Arguments Template

<setMaxAttachmentsPerMessage> 
    <maxAttachmentsPerMessage>xs:int</maxAttachmentsPerMessage>
</setMaxAttachmentsPerMessage>

Errors

Error When Returned
Unauthorized Thrown if the caller is not a system administrator.