2015-05-07 27 views
0

我是Zapi(Zephyr API)的新手。我正在嘗試評估Zapi API的自動化測試用例結果更新。在嘗試使用它獲取有關測試用例的詳細信息時,我在控制檯上看到「請登錄」消息。 我想從下面的鏈接中使用Zapi Rest API: http://docs.getzephyr.apiary.io/Zapi API:如何使用Zapi API登錄Zephyr以獲取詳細信息或更新任何測試用例

下面是我使用來獲取特定的測試案例的細節代碼:

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)); 

而且我得到以下消息在控制檯上:

<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中的任何測試用例。

謝謝。

+0

你忘記了信息。 – duffy356

+0

@ duffy356我在控制檯中得到一個HTML響應,並且我粘貼了上面的登錄消息。如果需要,我可以粘貼整個HTML響應, –

回答

0

您需要使用base64編碼的授權標頭中發送的請求是這樣的:

授權頭使用編碼的用戶名和密碼字符串的base64

頭= {「授權」:「基本」 + b64encode(用戶名+「 :「+ password」,「Content-Type」:「application/json」}

相關問題