Hi,
I am trying to connect to the Rally API through Java in order to create an application for pulling custom reports and am following the guide for basic query requests with the toolkit for Java:
https://github.com/RallyTools/RallyRestToolkitForJava/wiki/User-Guide
However, I am getting an error saying the URL is blocked. I have added all needed JARs to the classpath and they seem to be importing fine and have added my proxy server information. I have triple checked to see if I am completing each step in my code and made sure my API key is still active, but I can't seem to figure out the problem. Has this been seen before, or is there anything I could be missing?
Stack trace:
Exception in thread "main" java.io.IOException: HTTP/1.1 403 URLBlocked
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:172)
at com.MakeReport.Main.main(Main.java:44)
Code:
package com.MakeReport;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.client.HttpClient;
import com.rallydev.rest.request.QueryRequest;
import com.rallydev.rest.response.QueryResponse;
import com.rallydev.rest.util.Fetch;
import com.rallydev.rest.util.QueryFilter;
import java.io.IOException;
import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
public class Main {
public static void main (String[] args)throws URISyntaxException, IOException{
Proxy proxy;
RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "key");
restApi.setApplicationName("Amex GAR Epic Report");
HttpClient client = restApi.getClient();
System.out.println(client);
String version = restApi.getWsapiVersion();
System.out.println(version);
restApi.setProxy(new URI("url:port"));
try {
// GetRequest getRequest = new GetRequest("/hierarchicalrequirement");
// GetResponse getResponse = restApi.get(getRequest);
QueryRequest userStoryRequest = new QueryRequest("HierarchicalRequirement");
userStoryRequest.setFetch(new Fetch("FormattedID", "Name", "State", "Priority", "Project"));
userStoryRequest.setQueryFilter(new QueryFilter("Project.Name", "contains", "E_GAR_"));
userStoryRequest.setOrder("FormattedID ASC");
userStoryRequest.setPageSize(25);
userStoryRequest.setLimit(100);
QueryResponse queryResponse = restApi.query(userStoryRequest);
if (queryResponse.wasSuccessful()) {
System.out.println(String.format("\nTotal results: %d", queryResponse.getTotalResultCount()));
} else {
System.err.println("The following errors occurred: ");
for (String err : queryResponse.getErrors()) {
System.err.println("\t" + err);
}
}
System.out.println(queryResponse);
}
finally {
restApi.close();
}
}
}
Thanks