使用 rally-rest-api-2.1.2.jar 访问 rally 时出错

Getting error while accessing rally using rally-rest-api-2.1.2.jar

我在集会中收到 API 密钥的身份验证错误。甚至 api 密钥也被授予完全访问权限。

java.io.IOException: HTTP/1.1 401 Full authentication is required to access this resource 
at com.rallydev.rest.client.HttpClient.executeRequest(HttpClient.java:163)
at com.rallydev.rest.client.HttpClient.doRequest(HttpClient.java:145)
at com.rallydev.rest.client.ApiKeyClient.doRequest(ApiKeyClient.java:37)
at com.rallydev.rest.client.HttpClient.doGet(HttpClient.java:221)
at com.rallydev.rest.RallyRestApi.query(RallyRestApi.java:168)

这是代码:

String wsapiVersion = "v2.0";
restApi.setWsapiVersion(wsapiVersion);
restApi.setApplicationName(projectname);

QueryRequest testCaseRequest = new QueryRequest("Testsets");

if(null !=workspace && ""!=workspace)
    testCaseRequest.setWorkspace(workspace);

QueryResponse testCaseQueryResponse = restApi.query(testCaseRequest);

这里有什么问题吗?

我要检查的一件事是您是否在使用经过身份验证的代理服务器的公司网络内。除非您正确配置连接,否则代理会在到达 Rally 之前拒绝您的请求。

我刚刚想到的第二件事是,您是否在 header 中设置了正确的字段以启用 APIKey。我相信 Rally 服务器希望将 ZSESSIONID 设置为 APIKey。