Skip to main content

Attachment

This topic guides how to operate with attachments within TMT, including: upload, download and delete attachment.

In TMT, an attachment is any file that can be attached to a TMT business object (Test case, Run, Suite, etc.)

A TMT business object always attach the attachments into its body at the following path: Root/Attachments

It is an array of the attachment with definition can be found here:

danger

An attachment must be associated with a document. Otherwise, it will be removed automatically after 2 days.

Upload attachment

Attachments can be uploaded to the server using the upload attachment endpoint

info

There is no attachment update available. To change attachment create new attachment and un-assign old one.

MonthSavingsDetected Mime Type
JsonAttachmenttext/plain
JsonAttachment.jsonapplication/json
csvAttachmenttext/plain
csvAttachment.csvtext/csv

The table below shows the differences in mime type detection between uploading attachments with and without correct filename. There are differences in mime type detection for MS Word doc and docx files. Based on https://www.askingbox.com/info/mime-types-of-microsoft-office-file-formats, MS Word doc file will have mime type application/msword and MS Word docx file will have mime type application/vnd.openxmlformats-officedocument.wordprocessingml.document.

Attach an attachment

As we mentioned earlier, an attachment must be attached into a document, so that it can be used. This section guide you how to do it.

{
"FileName": "00bdd931-7284-4ca5-97ac-ff2d06d09640_thumbnail_big.jpeg",
"File": {
"content": null,
"attachment_id": "703b9da8-edb0-434b-9789-7f755957d7ed",
"internal_filename": "1730108285874-f2567f07-6d09-4d7f-8aa5-cd27f2c4c4f0.jpeg",
"original_filename": "00bdd931-7284-4ca5-97ac-ff2d06d09640_thumbnail_big.jpeg",
"size": 35169,
"mime_type": "image/png"
},
"CreatedAt": "2024-10-28T09:38:06",
"UploadOn": "2024-10-28",
"OriginalFileName": "00bdd931-7284-4ca5-97ac-ff2d06d09640_thumbnail_big.jpeg",
"UploadBy": "tmtdev",
"Referenced": false,
"CopyNumber": 0,
"ThumbnailId": "f1a218ff-e70b-4e84-9562-00d7651f9818"
}
  • Add this Attach object into Attachments array object of the document, then update the document (i.e. use MODIFY_DOCUMENT operation for saving a Test suite) The group Attachment must be located under the path Root/Attachment as we defined in above pathToField value

    See the update a test suite payload that containing an attachment for reference

Retrieve attachment

An attachment can be downloaded via 2 operations: LOAD_THUMBNAIL_URL and LOAD_ATTACHMENT_URL These returns the attachment urls, where you can make a call to download the attachment, but please be noticed that the url for attachment will be expired after 5 minutes due to the security purpose

Delete attachment

There is no API to delete attachments from the TMT system directly. The attachments are marked for deletion if the TMT object has unassigned attachment from its references. Then TMT will delete it in background automatically.

You can easily mark an attachment for deletion by simply removing the element from Attachments section of the desired document.

Attachment payload

FileName
string

Name of the file attached.

CreatedAt
string <date-time>

Timestamp when the attachment was created.

UploadOn
string <date>

Date when the file was uploaded.

OriginalFileName
string

Original filename as provided during upload.

UploadBy
string

Username of the uploader.

Referenced
boolean

Indicates if the attachment is referenced elsewhere.

CopyNumber
integer

Number of times the attachment has been copied.

ThumbnailId
string

Identifier for the attachment’s thumbnail image.

object (File)
{
  • "FileName": "string",
  • "CreatedAt": "2019-08-24T14:15:22Z",
  • "UploadOn": "2019-08-24",
  • "OriginalFileName": "string",
  • "UploadBy": "string",
  • "Referenced": true,
  • "CopyNumber": 0,
  • "ThumbnailId": "string",
  • "File": {
    }
}