CreateFileAttachment

Description

This service creates a new file attachment associated with an item.

Arguments

Argument Type Description
auth (optional) Auth The Auth type supplies credentials and optionally, a host name for licensing. The userId and password can be specified with HTTP BASIC or WS-SECURITY instead.
item (required) ItemIdentifier Specifies the item that receives the new file attachment.
attachmentContents (required) FileAttachmentContents The file attachment details and content.
Note: attachmentContents is of type FileAttachmentContents, but also includes attachment detail found in FileAttachment. The XML example below shows the parameters from both FileAttachment and FileAttachmentContents. See FileAttachment for more information.
options (optional) Options Holds name value pairing for future arguments.

Response

FileAttachment is returned. The newly added file attachment details are returned (not the content itself). For more detail, see FileAttachment.

Usage

The CreateFileAttachment call provides a method to add a single attachment to an auxiliary or primary item, given the proper privileges. If the call fails, a file attachment will not be added. To create multiple file attachments for a single item, CreateFileAttachment must be called for each attachment. You must have the table ID and item ID of the auxiliary or primary item prior to calling CreateFileAttachment because the IDs are required in the ItemIdentifier argument.

The file to be attached is sent as a base64 encoded attachment.

Note: The Maximum File Size setting in the Settings | Attachments tab in SBM System Administrator determines the size limit for file attachments that you can add to an item. The default maximum size is 500 MBs. However, use caution when adding or updating large files manually or in an automated manner, as this can negatively impact system performance.

Faults

XML

The following XML is a snippet of the payload that is sent with CreateFileAttachment.

<urn:CreateFileAttachment>
    <urn:auth>
        <urn:userId>admin</urn:userId>
        <urn:password></urn:password>
        <urn:hostname>localhost</urn:hostname>
    </urn:auth> 
    <urn:item>
            <urn:displayName></urn:displayName>
            <urn:id>109</urn:id>
            <urn:uuid></urn:uuid>
            <urn:tableId>1000</urn:tableId>
            <urn:tableIdItemId></urn:tableIdItemId>
            <urn:issueId></urn:issueId>
    </urn:item>
    <urn:attachmentContents>
        <urn:id>16</urn:id>
        <urn:name>pdf_doc</urn:name>
        <urn:fileName>relnotes.pdf</urn:fileName>
        <urn:showAsImage>false</urn:showAsImage>
        <urn:modificationDateTime></urn:modificationDateTime>
        <urn:url></urn:url>
        <urn:accessType>ATTACHACCESS-DEFAULT</urn:accessType>
        <urn:contentsBase64>
            <urn:data>cid:981662964041</urn:data>
        </urn:contentsBase64>
     </urn:attachmentContents>
</urn:CreateFileAttachment>