Access the CA Agile Central Web Services API On-Premises instance

Document ID : KB000057566
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

When a user of CA Agile Central on-premises instance clicks on Help link and follows the link to Web Services API, the user is taken to CA Agile Central on-demand (SaaS) login page: https://rally1.rallydev.com/slm/login.op?

Resolution

To access Web Services interactive documentation and object model specific to your on-premises workspace, replace rally1.rallydev.com with your CA Agile Central on-premises server.,
following this format:

https://<your CA Agile Central server>/slm/doc/webservice/

For example, if the CA Agile Central on-premises server is 10.32.16.89:

User-added image
the link to WS API is https://10.32.16.89/slm/doc/webservice/

User-added image

This URL can also be used in custom code as shown in a Ruby example and a Java example below:

Using CA Agile Central REST Toolkit for Ruby:
require 'rally_api'

#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "My Utility"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to CA Agile Central
config = {:base_url => "https://10.32.16.89/slm"}
config[:username] = "admin@co.com"
config[:password] = "secret"
config[:workspace] = "Workspace 3"
config[:project] = "P0"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()
config[:version] = "v2.0"

@rally = RallyAPI::RallyRestJson.new(config)

obj = {}
obj["user"] = {"_ref" => "https://10.32.16.89/slm/webservice/v2.0/user/23254"}
obj["Role"] = "Editor"
#obj["Role"] = "Viewer"
obj["Project"] = {"_ref" => "https://10.32.16.89/slm/webservice/v2.0/project/23862" }
new_projectpermission = @rally.create("projectpermission", obj)
Using Java REST Toolkit for Java:
?
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.google.gson.JsonObject;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.request.CreateRequest;
import com.rallydev.rest.response.CreateResponse;
import com.rallydev.rest.util.Ref;


public class CreateStoryOnPremCountBytesInString {

	public static void main(String[] args) throws URISyntaxException, IOException {
		

	       String host = "http://10.32.16.77";   //had to use http to bypass Exception : javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
	       String username = "user@co.com";
	       String password = "secret";
	        String wsapiVersion = "v2.0";
	        String projectRef = "/project/1234";
	        String applicationName = "Example-createStory";
	        
		
        RallyRestApi restApi = new RallyRestApi(
        		new URI(host),
        		username,
        		password);
        restApi.setWsapiVersion(wsapiVersion);
        
        
        String storyName = //"................................................................................."; //your string here
        restApi.setApplicationName(applicationName);   
        byte[] utf8Bytes = storyName.getBytes("UTF-8");
        System.out.println(utf8Bytes.length); // prints "253"
        
        byte[] utf16Bytes= storyName.getBytes("UTF-16");
        System.out.println(utf16Bytes.length); // prints "328"

        byte[] utf32Bytes = storyName.getBytes("UTF-32");
        System.out.println(utf32Bytes.length); // prints "652"

        byte[] isoBytes = storyName.getBytes("ISO-8859-1");
        System.out.println(isoBytes.length); // prints "163"

        byte[] winBytes = storyName.getBytes("CP1252");
        System.out.println(winBytes.length); // prints "163"
        
        try {
            
	            System.out.println("Creating a story...");
	            JsonObject newStory = new JsonObject();
	            
	            newStory.addProperty("Name", storyName);
	            newStory.addProperty("Project", projectRef); 

	             
	            CreateRequest createRequest = new CreateRequest("hierarchicalrequirement", newStory);
	            //System.out.println(createRequest.getBody());
	            CreateResponse createResponse = restApi.create(createRequest);  
	            if (createResponse.wasSuccessful()) {
	            	
	            	System.out.println(String.format("Created %s", createResponse.getObject().get("_ref").getAsString()));          
	            	String[] warningList;
	            	warningList = createResponse.getWarnings();
	            	for (int w = 0; w < warningList.length; w++){
	            		System.out.println(warningList[w]);
	            	}
		            //Read epic story
		            String storyRef = Ref.getRelativeRef(createResponse.getObject().get("_ref").getAsString());
		            System.out.println(String.format("\nReading epic story %s...",storyRef));
		        }
		        else {
	            	String[] createErrors;
	            	createErrors = createResponse.getErrors();
	        		System.out.println("Error!");
	            	for (int i=0; i<createErrors.length;i++) {
	            		System.out.println(createErrors[i]);
	            	}
	            }
        } finally {
            //Release all resources
            restApi.close();
        }   

	} 
	
}


?