Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Attaching evidence to a test execution API POST



I am using Java + TM4J REST API to do a GET request on a test cycle, and test all the test cases that live within that cycle, before then doing a test execution POST to return the results of the tests when they are complete. As part of this, my program captures a screenshot of the browser at point of test failure and stores this locally within the project as a PNG image. All works so far..


If you run a test execution through the GUI, you can copy and paste an image in or use the upload file to attach the image.

I cannot seem to work out however, or find any resource on how to use Java to attach an image or to paste in the image as part of the test steps or comments of that test execution. There is no API endpoints (checked with Adaptivist themselves on that) but there must be some way of getting around this problem by passing the image along with the api POST as part of the JSON body. 


Thankful for any help regarding this.

1 answer

1 accepted

1 vote
Answer accepted
Deleted user Jan 07, 2020

TM4J Server API (v1) now has methods to post attachments to test executions and steps within them.

As per the API specification, in order to attach a file to a test execution (which corresponds to clicking on "Drop files here or select files" in TM4J web GUI on an open execution) use a POST call to the following resource: /testresult/{testResultId}/attachments

Mind that the testResultId part is not a test execution key, but the ID returned by the API when creating a test execution with the appropriate call.

The attachment must be passed as a multipart/form-data media type. E.g.:

POST https://jira.server.local/rest/atm/1.0/testresult/65208/attachments HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: PostmanRuntime/7.15.0
Content-Type: multipart/form-data; boundary="----=_Part_5_1594638400.9687465465446"
MIME-Version: 1.0
Authorization: Basic PWhgKJHGKjhgkJHGKJHGUYT
Content-Length: 5766
Host: jira.server.local
Connection: Keep-Alive

Content-Type: application/octet-stream; name=error.log
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="file"; filename="error.log"


Is this the same when using TM4J for cloud? That is what I am currently using.

I haven't worked with TM4J Cloud API, but judging by the documentation, unfortunately no methods are implemented to work with attachments:

It has just appeared in TM4J Server and let's hope they're working to add it in the Cloud ))

QIP Shot - Screen 01.02.20 11-34-39.png

Fingers crossed, thanks for server side info :)

@Scott Maitland, the create attachment request is finally implemented in Zephyr Cloud. Please take a look here: Create Attachment

I could not get it work, somebody can help me ?


Infact I realy wonder why testrun/testcase is not have a attachments ??

I use below to update test result in a cycle 


However this form does not have attachment.

And creating testresult id says it doesnt deal with a testrun, then how will I attach a file to test in a cycle then ????


In fact I tried every attachtment in this API but none of them worked for me

Zephyr Scale Server API (v1) (

I can upload a file to test case, test cycle (test run), testresult that I have created but not a test instance in a cycle

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events