Getting 403 Forbidden in my restTemplate client

Not applicable

I am getting 403 error while calling "https://api.enterprise.apigee.com/v1/organizations/firstdatanp/apis/**Test/. I am using restTemplate for sending request..please advise

0 3 6,707
3 REPLIES 3

pls check if you have necessary roles in the organization - 'firstdatanp'. Are you able to access this organization/api in the UI?

Not applicable

Yes I can access same URL from my local client. I am using httpClient for the same but as soon as I deploy the client in websphere dev server it gives me <big>Access Denied (policy_denied)</big> error.

Not applicable

Sample code which works perfectly in local but not with websphere :

DefaultHttpClient httpclient = new DefaultHttpClient();

UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials("can no provide in this forum*", "*can no provide in this forum*"); HttpHost proxy = new HttpHost("myProxy**", 80);

// Add AuthCache to the execution context

BasicHttpContext localcontext = new BasicHttpContext();

HttpGet httpget = new HttpGet("https://api.enterprise.apigee.com/v1/organizations/firstdatanp/apis/"+api); httpget.addHeader(new BasicScheme().authenticate(usernamePasswordCredentials, httpget, localcontext)); httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); HttpResponse response = httpclient.execute(httpget)