Java Rally api lookback api authentication

247 views Asked by At

getting the exception

com.rallydev.lookback.LookbackException: Authorization failed, check username and password

I've API key also. but I dont how to use with lookback api

Below is my code

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

Any suggestions please?

2

There are 2 answers

0
Kyle Morse On BEST ANSWER

The lookback toolkit was an experimental toolkit and is not fully supported. https://github.com/RallyTools/Rally-Lookback-Toolkit

I doubt it contains support for api keys. According to the docs though you should just use setCredentials

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

.setCredentials("username", "password")
0
James Jithin On

Can use API Key for the Lookback API. Have to set this in the HTTP Header.

Import

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

Code

Header header = new BasicHeader("ZSESSIONID", "_MYRALLYKEYLKEY01234567890ABCDEFGH");
HttpClient httpClient = HttpClients.custom().setDefaultHeaders(Collections.singleton(header)).build();
LookbackApi lookbackApi = new LookbackApi(httpClient);