How to add an attachment to an execution under test cycle using zapi rest api
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2021
07:47 AM
12-16-2021
07:47 AM
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/jira/rest/zapi/latest/attachment?entityId=&entityType=
But how do I pass the attachment file or attachment file link(url) to this api?
Should entityId be 'executionId' and entityType 'Execution' ??
Thanks.
Solved! Go to Solution.
Labels:
- Labels:
-
APIs
-
documentation
-
Test Cycle
-
Test Execution
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2021
02:12 PM
12-16-2021
02:12 PM
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 requests
url = "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.
