Skip to Main Content

Application Development Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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 on Sep 2 2018
Added on Jul 26 2018
4 comments
184 views