获得例外
com.rallydev.lookback.LookbackException:授权失败,检查用户名和密码
我也是API密钥。但是我不知道如何使用lookback 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();
有什么建议吗?
答案 0 :(得分:1)
回顾工具包是一个实验工具包,并不完全支持。 https://github.com/RallyTools/Rally-Lookback-Toolkit
我怀疑它是否包含对api密钥的支持。 根据文档,你应该只使用setCredentials
https://github.com/RallyTools/Rally-Lookback-Toolkit#rally-lookback-api-toolkit
.setCredentials("username", "password")
答案 1 :(得分:0)
可以将API密钥用于回溯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);