An attachment is a file that is associated with another resource, such as a defect.


Attachments are specified by their numerical ID. The file name cannot be used as the attachment ID. To get a file by name, use a query. See the example under Query Parameters.

The query parameter by-id is not valid.

To GET the binary file content, use header Accept: application/octet-stream.

To GET the binary file content and the meta-data, use header Accept: multipart/mixed.

To POST a new file, use header content-type: multipart/form-data header.





  • See General Notes and Limitations
  • Only the file name and description can be changed with a PUT operation.

    To change the contents of the file, POST the new version, using override-existing-attachment="y" in the multipart form data.

    To change the ref-subtype, delete the attachment and POST a new version.

Header Parameters

Query Parameters

The valid query parameters are:

  • entity.type - For example, "defect".
  • - The ID of the entity associated with the attachment.
  • name - The file name. Only one file name can be specified. For example, this query is not valid: ?query={entity.type[defect];[1];name[file1.txt or file2.txt]}.
  • id - The attachment ID. If you use the id field as a query parameter, no other field can be used. For example: ?query={id[2 or 4]}

For a GET operation, if the file name is used in a filter, the entity.type and parameters are required. More than one can be specified.

Example: /qcbin/api/domains/my-domain/projects/my-project/attachments/?query={entity.type[requirement];[2 or 4];name[my-file.txt]}

Header Parameters


GET with an Accept header of application/json returns a descriptor of the attachment entity.

GET with an Accept header of application/octet-stream, returns the file. The Content-Type header reflects the type of file.

See Return Values

See Also