Forum Stats

  • 3,853,853 Users
  • 2,264,287 Discussions
  • 7,905,483 Comments

Discussions

Webcenter Portal 12.x REST API - Call from java code

User543071 - Oracle
User543071 - Oracle Member Posts: 11
edited Aug 5, 2018 11:51PM in WebCenter Portal

Hello All,

I called  http://hostname/rest/api/resourceIndex  using REST Client in the following way, using Basic Auth

WebResource webResource = restClient.resource(URL);

ClientResponse response = webResource.accept("application/json") .header("Authorization", "Basic " + authStringEnc).get(ClientResponse.class);

The above service returns array of links, one of which is related to search collection

I modified the URL, startIndex=0&q=oracle and kept utoken as same

URL - http://hostname/rest/api/searchcollection?startIndex=0&q=oracle&utoken=IEwLCLvSnDFwO9ZL1t7g9tmqD-yPHskQQojfKfmkIYsz_w** (modified the template)

When i make the second call with  search collection url like below

WebResource webResource = restClient.resource(URL);

ClientResponse response = webResource.accept("application/json") . get(ClientResponse.class);

It always returns 403 error. I tried adding Basic Auth header, but the same error.

But the same url woks fine in Postman and browser.

How to make the REST Call with utoken, should i deploy the application and run in context of portal.

Or can i run as independent application or java class.

Thanks

Praveen

Best Answer

Answers

This discussion has been closed.