首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Zapi API:如何使用Zapi API登录Zephyr,以便获取详细信息或更新任何测试用例

Zapi API:如何使用Zapi API登录Zephyr,以便获取详细信息或更新任何测试用例
EN

Stack Overflow用户
提问于 2015-05-07 18:52:05
回答 1查看 2.2K关注 0票数 0

我刚接触Zapi(Zephyr )。我正在尝试为自动测试用例结果更新评估Zapi API。在尝试获取有关使用它的测试用例的详细信息时,我在控制台上收到“请登录”消息。我正在尝试从以下链接使用Zapi Rest API:http://docs.getzephyr.apiary.io/

下面是我用来获取特定测试用例详细信息的代码:

代码语言:javascript
复制
Client client = ClientBuilder.newClient();
Response response = client.target("https://SERVER_NAME").path("/jira/browse/DEV-3121").request(MediaType.APPLICATION_JSON_TYPE).get();
        System.out.println("status: " + response.getStatus());
        System.out.println("headers: " + response.getHeaders());
        System.out.println("body:" + response.readEntity(String.class));

我在控制台上看到了下面的消息:

代码语言:javascript
复制
<fieldset class="hidden parameters">
    <input type="hidden" title="loggedInUser" value="">
    <input type="hidden" title="ajaxTimeout" value="The call to the JIRA server did not complete within the timeout period.  We are unsure of the result of this operation.">
    <input type="hidden" title="JiraVersion" value="6.2.7" />
    <input type="hidden" title="ajaxUnauthorised" value="You are not authorized to perform this operation.  Please log in.">
<fieldset/>

请让我知道,我在这里遗漏了什么,否则有没有其他方法可以让我获取测试用例的详细信息,或者更新Jira-Zephyr中的任何测试用例。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2015-06-03 22:31:14

您需要发送带有base64编码的授权头的请求,如下所示:

授权头使用base64编码的用户名和密码字符串

headers = {"Authorization ":“Basic”+b64encode(用户名+“+密码),"Content-Type":”应用程序/json“}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30098986

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档