我花了无数个小时试图让附件资源 API 工作但无济于事。我在这里提到了文档:http ://docs.getzephyr.apiary.io/#executionresourceapis
但他们并没有多大帮助,Zephyr 支持在过去 3 个月内没有回答我的任何问题。
这是我的卷曲电话:
curl -D- -u user:pass -X POST -H "Content-Type: multipart/form-data" -H "X- Atlassian-Token: nocheck" -F "file=/home/jared/apiautomation/output.html" "https://jiraurl/rest/zapi/latest/attachment?entityId=3019&entityType=execution"
我也试过php:
<?php
$url = "http://jiraurl/rest/zapi/latest/attachment?entityId=3091&entityType=execution";
$upass="";
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, $upass);
$file_name_with_full_path = realpath("/home/jared/postman/authentication/output.html");
$post = array("file=@.$file_name_with_full_path; filename=output.html;");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('X-Atlassian-Token: nocheck'));
$response = curl_exec($curl);
curl_close ($curl);
?>
对于这两个示例,我都得到了不受支持的媒体类型。这没有意义,因为我可以通过 Jira 附加它。我在这一点上完全迷失了。我引用了: https ://answers.atlassian.com/questions/268253/add-attachment-to-test-execution-using-zapi
请帮忙。:)