Attachments

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

Remarks

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.

URIs

/qcbin/api/domains/{domain}/projects/{project}/attachments

/qcbin/api/domains/{domain}/projects/{project}/attachments/{ID}

Limitations

  • 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".
  • entity.id - 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];entity.id[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 entity.id parameters are required. More than one entity.id can be specified.

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

Header Parameters

Returns

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