The comment in the original question above should be the accepted answer. For what it's worth, however, there is a constructor that also accepts a server, username and password (although this is considered deprecated in favor of the api key approach)
//preferred RallyRestApi api = new RallyRestApi(new URI("https://rally1.rallydev.com", "myAPIKey"); //deprecated, but still possible RallyRestApi api = new RallyRestApi(new URI("https://rally1.rallydev.com", "username", "password");
source share