Web Services Developer's Guide → Web Services API Reference → SBM Application Web Services → Application Calls → CreateFileAttachment
This service creates a new file attachment associated with an item.
|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.|
FileAttachment is returned. The newly added file attachment details are returned (not the content itself). For more detail, see FileAttachment.
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.
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>
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.