bharath-vz7
4 years agoNew Contributor
How to add an attachment to an execution under test cycle using zapi rest api
Hi, How to add an attachment to an execution under test cycle using zapi rest api. I intend to use python as a programming language. I believe its by using this api-> http://localhost:2990/j...
- 4 years ago
ound the solution:
Api is -> /rest/zapi/latest/attachment?entityId=12345&entityType=Execution
entityId is executionId.
Send the file as form-data, you will see this option in postman.
Below is the Python code if needed.
import requestsurl = "baseUrl/rest/zapi/latest/attachment?entityId=12345&entityType=Execution"payload={}files=[('file',(filename,open('complete_file_path','rb'),'text/html'))]# File is html in this example. You can pass multiple files in the above list, just replicate.# for header pass basic auth.response = requests.request("POST", url, headers=headers, files=files)Thanks.