Attachments_Add Operation

Applies to QAComplete�14.4, last modified on August 06, 2024
Since release 10.2, this functionality is obsolete and is supported for backward compatibility only. We recommend that you use QAComplete REST API to access and manage data in QAComplete.

Adds an attachment to an item in QAComplete (a defect, release, requirement, and so on). You can attach files, URLs, and UNC paths.

Requirements

The authenticating user must belong to a security group that has the Add privilege for the type of the item (Defects, Releases, and so on) to which you are adding the attachment.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information and the project ID to which you want to add an attachment.

Attachment  :  Attachment, required

The Attachment object to add.

File  :  base64binary, required

In raw SOAP requests, this is the file contents encoded in Base64.

If you use wrapper classes, this is a byte array that represents the file contens.

SaveOriginal  :  boolean, required

Specifies whether to replace the attachment if it already exists.

Result

The ID of the added attachment.

Remarks

The Attachment object has matching Id and Name properties, for example, UpdateUserId and UserName. To set them, specify the value only for the Id property. The corresponding Name property will be set automatically.

Example

Sample Code
Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 1841 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/Attachments_Add"
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Attachments_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Attachment>
        <FKId>34</FKId>
        <EntityCode>Releases</EntityCode>
        <FileName>doc.pdf</FileName>
        <Title>Sample PDF file</Title>
      </Attachment>
      <File> JVBERi0xLjQKJfbk/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmVyc2lvbiAvMS40Ci9QYW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Y1RTQ+XQovU2l6ZSA5Cj4+CnN0YXJ0eHJlZgo1NjAKJSVFT0YK </File>
      <SaveOriginal>false</SaveOriginal>
    </Attachments_Add>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1849 {Insert an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Attachments_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Attachment>
        <FKId>34</FKId>
        <EntityCode>Releases</EntityCode>
        <FileName>doc.pdf</FileName>
        <Title>Sample PDF file</Title>
      </Attachment>
      <File> JVBERi0xLjQKJfbk/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmVyc2lvbiAvMS40Ci9QYWdlcyAyIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovVHlwZSAvUGFnZXMKL0tpZHMgWzMgMCBSXQovQ291bnQgMQo+PgplbmRvYmoKMyAwIG9iago8PAovVHlwZSAvUGFnZQovTWVkaWFCb3ggWzAuMCAwLjAgNjEyLjAgNzkyLjBdCi9QYXJlbnQgMiAwIFIKL0NvbnRlbnRzIDQgMCBSCi9SZXNvdXJjZXMgNSAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0ZpbHRlciBbL0ZsYXRlRGVjb2RlXQovTGVuZ3RoIDYgMCBSCj4+CnN0cmVhbQ0KeJxzCuHSdzNQMDRSCEnjMjIwUDAH4pAULg2P1JycfIXw/KKcFEVNhZAsLtcQLgDr5wrxDQplbmRzdHJlYW0KZW5kb2JqCjUgMCBvYmoKPDwKL0ZvbnQgNyAwIFIKPj4KZW5kb2JqCjYgMCBvYmoKNTEKZW5kb2JqCjcgMCBvYmoKPDwKL0YwIDggMCBSCj4+CmVuZG9iago4IDAgb2JqCjw8Ci9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovQmFzZUZvbnQgL0hlbHZldGljYS1Cb2xkCi9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nCj4+CmVuZG9iagp4cmVmCjAgOQowMDAwMDAwMDAwIDY1NTM1IGYNCjAwMDAwMDAwMTUgMDAwMDAgbg0KMDAwMDAwMDA3OCAwMDAwMCBuDQowMDAwMDAwMTM1IDAwMDAwIG4NCjAwMDAwMDAyNDcgMDAwMDAgbg0KMDAwMDAwMDM3NiAwMDAwMCBuDQowMDAwMDAwNDA5IDAwMDAwIG4NCjAwMDAwMDA0MjcgMDAwMDAgbg0KMDAwMDAwMDQ1OCAwMDAwMCBuDQp0cmFpbGVyCjw8Ci9Sb290IDEgMCBSCi9JRCBbPEUzN0VCMTVDM0Y3MDE0REU0RUVDMjhGRTQ1ODVGNUU0PiA8RTM3RUIxNUMzRjcwMTRERTRFRUMyOEZFNDU4NUY1RTQ+XQovU2l6ZSA5Cj4+CnN0YXJ0eHJlZgo1NjAKJSVFT0YK </File>
      <SaveOriginal>false</SaveOriginal>
    </Attachments_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 382 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Attachments_AddResponse xmlns="http://www.pragmaticsw.com/">
      <Attachments_AddResult>19</Attachments_AddResult>
    </Attachments_AddResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 392 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Attachments_AddResponse xmlns="http://www.pragmaticsw.com/">
      <Attachments_AddResult>19</Attachments_AddResult>
    </Attachments_AddResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

Attachments Operations
Attachments_Delete
Attachments_GetAttachment
Attachments_GetAttachmentsList
SOAP API Reference

Highlight search results