Attachments_GetAttachment 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.

Use this operation to download attachments from QAComplete.

The operation returns the attachment contents as a Base64 string or a byte array. You can write this data to a file and use this file later.

Requirements

The authenticating user must belong to a security group that has the Read privilege for the type of the item (Defects, Releases, and so on) that contains the attachment.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information and the project ID that contains the attachment.

AttachmentId  :  integer, required

The attachment ID. You can see this ID on the attachment edit form in QAComplete or you can get it from the Attachments_GetAttachmentsList operation.

Result

Raw SOAP responses contain a Base64 string that represents the file contents.

If you use wrapper classes, you get the file contents as a byte array.

Example

Sample Code

To view sample code that shows how to use the Attachments_GetAttachment operation to load a file attached to a defect, see Download Attachments.

Sample Request XML

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

<?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_GetAttachment xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <AttachmentId>12</AttachmentId>
    </Attachments_GetAttachment>
  </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: 533 {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_GetAttachment xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <AttachmentId>12</AttachmentId>
    </Attachments_GetAttachment>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1599 {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_GetAttachmentResponse xmlns="http://www.pragmaticsw.com/">
      <Attachments_GetAttachmentResult> JVBERi0xLjQKJfbk/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmVyc2lvbiAvMS40Ci9QYWdlcyAyIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovVHlwZSAvUGFnZXMKL0tpZHMgWzMgMCBSXQovQ291bnQgMQo+PgplbmRvYmoKMyAwIG9iago8PAovVHlwZSAvUGFnZQovTWVkaWFCb3ggWzAuMCAwLjAgNjEyLjAgNzkyLjBdCi9QYXJlbnQgMiAwIFIKL0NvbnRlbnRzIDQgMCBSCi9SZXNvdXJjZXMgNSAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0ZpbHRlciBbL0ZsYXRlRGVjb2RlXQovTGVuZ3RoIDYgMCBSCj4+CnN0cmVhbQ0KeJxzCuHSdzNQMDRSCEnjMjIwUDAH4pAULg2P1JycfIXw/KKcFEVNhZAsLtcQLgDr5wrxDQplbmRzdHJlYW0KZW5kb2JqCjUgMCBvYmoKPDwKL0ZvbnQgNyAwIFIKPj4KZW5kb2JqCjYgMCBvYmoKNTEKZW5kb2JqCjcgMCBvYmoKPDwKL0YwIDggMCBSCj4+CmVuZG9iago4IDAgb2JqCjw8Ci9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovQmFzZUZvbnQgL0hlbHZldGljYS1Cb2xkCi9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nCj4+CmVuZG9iagp4cmVmCjAgOQowMDAwMDAwMDAwIDY1NTM1IGYNCjAwMDAwMDAwMTUgMDAwMDAgbg0KMDAwMDAwMDA3OCAwMDAwMCBuDQowMDAwMDAwMTM1IDAwMDAwIG4NCjAwMDAwMDAyNDcgMDAwMDAgbg0KMDAwMDAwMDM3NiAwMDAwMCBuDQowMDAwMDAwNDA5IDAwMDAwIG4NCjAwMDAwMDA0MjcgMDAwMDAgbg0KMDAwMDAwMDQ1OCAwMDAwMCBuDQp0cmFpbGVyCjw8Ci9Sb290IDEgMCBSCi9JRCBbPEUzN0VCMTVDM0Y3MDE0REU0RUVDMjhGRTQ1ODVGNUU0PiA8RTM3RUIxNUMzRjcwMTRERTRFRUMyOEZFNDU4NUY1RTQ+XQovU2l6ZSA5Cj4+CnN0YXJ0eHJlZgo1NjAKJSVFT0YK</Attachments_GetAttachmentResult>
    </Attachments_GetAttachmentResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1609 {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_GetAttachmentResponse xmlns="http://www.pragmaticsw.com/">
      <Attachments_GetAttachmentResult> JVBERi0xLjQKJfbk/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmV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RERTRFRUMyOEZFNDU4NUY1RTQ+XQovU2l6ZSA5Cj4+CnN0YXJ0eHJlZgo1NjAKJSVFT0YK</Attachments_GetAttachmentResult>
    </Attachments_GetAttachmentResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

Attachments Operations
Attachments_Add
Attachments_Delete
Attachments_GetAttachmentsList
SOAP API Reference

Highlight search results