Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

How get Images to get_results using API?


I am doing a vba macro to get Images of results and create a ppt file.

but when I try acess “index.php?/attachments/get/6175” using API is returned a text

how can I download this file?


Hi Bruno,

There’s currently no direct API for downloading attachments via the API but would the print views be an option maybe? Just click on the printer icon when viewing a test and this would also render embedded screenshots.



Hi Tobias,

The button print not serve to me. because I am doing a way to drop imagens from site and send to Clients.

I try many ways to acess and login in the testRail.

For example.
If I change “/index.php?/api/v2/get_projects” for “/index.php?/attachments/get/6175” Is returned the Login page

There is a way download this images by code?

It is code that I am using to get projects for example.

Set oRequest = CreateObject(“WinHttp.WinHttpRequest.5.1”)

With oRequest
.Open “GET”, url_base + “/index.php?/api/v2/get_projects”, False
’.Open “GET”, url_base + “/index.php?/attachments/get/6175”, False
’.SetRequestHeader “Content-Type”, “text/html”
.SetRequestHeader “Content-Type”, "application/json"
auth = Base64Encode(user + “:” + pass)
.SetRequestHeader “Authorization”, "Basic " + auth
sResult = .ResponseText
End With

Accessing Testrail API using VBA in Excel

Hi Bruno,

One option is in fact to use index.php?attachments/get/###. This is not a regular API function (but part of the UI) so the API authentication wouldn’t work and you would need to submit the regular session cookie of an authenticated user session.