cancel
Showing results for 
Search instead for 
Did you mean: 

Using the SAP HCP User API in cloud portal site

chiara_ferrari
Explorer
0 Kudos

Hi experts,

I need to create a widget that displays the logged user’s attributes (not only ID, e-mail, ..), and add it in a cloud portal site. I managed to create such application in the SAP Web IDE following this post https://blogs.sap.com/2015/04/16/using-the-hcp-user-api-in-web-ide/ and this documentation https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/1de599bf722446849d2b2e10132....

From the web IDE I can reach the url: https://webidecp-xxxxxxxxxx.dispatcher.hana.ondemand.com/services/userapi/attributes and retrieve all the attributes I have set.

From the portal I get an error 404 not found: https://flpnwc-xxxxxxxxxx.dispatcher.hana.ondemand.com/services/userapi/attributes.

I guess I need to change some configuration in the files neo-app.json or manifest.json, does anybody have any suggestion on how to do that?

Thanks in advance,

Chiara

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member199536
Active Participant

Hi Chiara,

When running in a portal site or launchpad, you can use the Shell UserInfo service to get the logged in user properties:

var UserInfo = sap.ushell.Container.getService("UserInfo");

var user = UserInfo.getUser();

user.getEmail();

user.getId();

user.getFullName();

....

Otherwise for using the platforms User API you would need to "reroute" it when running in a portal widget like any other API call. For more information take a look at my reply on this thread.

Regards, Ido