I'm trying to access FP resources via REST API. I've succeed with Firefox REST Client but failed to write java code.
Here is snippet of my code that returns "HTTP/1.1 401 Unauthorized".
Could you please write what's wrong with authorization or provide sample code?
HttpClient client = new DefaultHttpClient();
AuthScope as = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT);
UsernamePasswordCredentials upc = new UsernamePasswordCredentials("administrator", "focalpoint");
((AbstractHttpClient) client).getCredentialsProvider().setCredentials(as, upc);
BasicHttpContext localContext = new BasicHttpContext();
BasicScheme basicAuth = new BasicScheme();
HttpHost targetHost = new HttpHost("Kvhoclm1.delta.internal", 8080, "http");
HttpGet httpget = new HttpGet("http://Kvhoclm1.delta.internal:8080/fp/resources/workspaces/2/modules/13/elements/61/attributes/984");
response = client.execute(targetHost, httpget,localContext);
HttpEntity entity = response.getEntity();
Object content = EntityUtils.toString(entity);
-Thanks in advance
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
2 replies Latest Post - 2013-02-05T03:58:52Z by SystemAdmin
IBM Timur Markunin 270002T9M3
Pinned topic REST API: Response Status code:HTTP/1.1 401 Unauthorized
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-02-05T03:58:52Z at 2013-02-05T03:58:52Z by SystemAdmin
Shafeeq AM 270002GT4M155 PostsACCEPTED ANSWER
Re: REST API: Response Status code:HTTP/1.1 401 Unauthorized2012-07-13T14:44:48Z in response to IBM Timur MarkuninHi,
A good starting point is RESTAPIExamples.zip (a complete eclipse project) shipped with Product. On Installation its placed in <FP_HOME>/apiexamples/. The sample code works against 'IT Portfolio Configuration Template'. Refer http://publib.boulder.ibm.com/infocenter/rfphelp/v6r5/topic/com.ibm.rational.fp.api.doc/topics/r_restapi_doc.html