Skip to Main Content

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

User543071 - OracleJul 26 2018 — edited Aug 5 2018

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

This post has been answered by User543071 - Oracle on Aug 5 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Sep 2 2018
Added on Jul 26 2018
4 comments
93 views