0

得到异常

com.rallydev.lookback.LookbackException:授权失败,请检查用户名和密码

我也有 API 密钥。但我不知道如何使用回溯 api

下面是我的代码

LookbackApi lookback = new LookbackApi()
                    .setServer("https://" + "rally1.rallydev.com")
                    .setProxyServer("http://" + "proxyserver" + ":" + "proxyport")
                    .setProxyCredentials("testuer","testpass")
                    .setWorkspace("/workspace/1234");
            LookbackResult  result = lookback.newSnapshotQuery()
                    .addFindClause("_TypeHierarchy", -51038)
                    .execute();

请问有什么建议吗?

4

2 回答 2

1

回溯工具包是一个实验性工具包,并不完全受支持。 https://github.com/RallyTools/Rally-Lookback-Toolkit

我怀疑它是否包含对 api 密钥的支持。根据文档,尽管您应该只使用 setCredentials

https://github.com/RallyTools/Rally-Lookback-Toolkit#rally-lookback-api-toolkit

.setCredentials("username", "password")
于 2017-09-18T22:09:54.250 回答
0

可以将 API Key 用于 Lookback API。必须在 HTTP 标头中设置它。

进口

import org.apache.http.Header;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;

代码

Header header = new BasicHeader("ZSESSIONID", "_MYRALLYKEYLKEY01234567890ABCDEFGH");
HttpClient httpClient = HttpClients.custom().setDefaultHeaders(Collections.singleton(header)).build();
LookbackApi lookbackApi = new LookbackApi(httpClient);
于 2019-03-22T20:07:59.140 回答