mjuricek1 Absent Member.
Absent Member.
1507 views

IDM 4.7 - how to call REST API by curl and JavaScript

Hi guys,

New IDM 4.7 removes RIS and there is a new REST API (or there is a new way how to us it). And unfortunatelly, it is not clear to me how to authenticate and use the new REST API.
Do you have any example? (calling by curl or Javascript).

Before I used curl like this:
curl -v -H "Accept: application/json" -H "RESTAuthorization: dWFkbWluOm5vdmVsbA==" http://192.168.239.130:8180/RIS/v1/identities

and in JavaScript, I used sessions:

function obtainSessionSecret(aUserAppAddress){
var pObtainedSecret ="";
$.ajax({
type: "POST",
url: aUserAppAddress+"/RIS/v1/AuthorizationSession",
async: false,
beforeSend: function(request){
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
},
dataType: "json",
data:"{\"Authorization\":\"dWFkbWluOm5vdmVsbA==\"}",
success: function (response){
pObtainedSecret = ""+response.SessionSecret;
}
});
return pObtainedSecret;
}

Can you please send me an example how to create a session and get e.g. all users or all running WFs by REST and by curl?

btw. do I need to active REST API as in older IDM? (before I had to edit /opt/netiq/idm/apps/tomcat/webapps/RIS/WEB-INF/web.xml)

Thank you in advace for your help.

Regards,
Milan
Labels (1)
Tags (2)
0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

Re: IDM 4.7 - how to call REST API by curl and JavaScript

On 2018-05-03 12:14, mjuricek wrote:
>
> Hi guys,
>
> New IDM 4.7 removes RIS and there is a new REST API (or there is a new
> way how to us it). And unfortunatelly, it is not clear to me how to
> authenticate and use the new REST API.
> Do you have any example? (calling by curl or Javascript).
>
> Before I used curl like this:
> curl -v -H "Accept: application/json" -H "RESTAuthorization:
> dWFkbWluOm5vdmVsbA==" http://192.168.239.130:8180/RIS/v1/identities
>
> and in JavaScript, I used sessions:
>
> function obtainSessionSecret(aUserAppAddress){
> var pObtainedSecret ="";
> $.ajax({
> type: "POST",
> url: aUserAppAddress+"/RIS/v1/AuthorizationSession",
> async: false,
> beforeSend: function(request){
> request.setRequestHeader("Accept", "application/json");
> request.setRequestHeader("Content-Type", "application/json;
> charset=UTF-8");
> },
> dataType: "json",
> data:"{\"Authorization\":\"dWFkbWluOm5vdmVsbA==\"}",
> success: function (response){
> pObtainedSecret = ""+response.SessionSecret;
> }
> });
> return pObtainedSecret;
> }
>
> Can you please send me an example how to create a session and get e.g.
> all users or all running WFs by REST and by curl?



While RIS was basically a REST to SOAP gateway, as of 4.6.2 the REST
APIs are now "natively" provided by IDMProv. And they use OAuth as
authentication mechanism. You first need to get an access token from OSP
and then use an "Authorization: Bearer" header for the actual call.
There is an example for that in the documentation. See https://<your
idmapps server>:<port>/idmappsdoc/

The documentation is generated using https://swagger.io/. So depending
on your language of choice, you could use the swagger tools to
automatically create client code.

If you need to access the APIs from a client with JavaScript, you can
find a framework and examples to do that at https://github.com/MicroFocus/CX

--
Norbert
--
Norbert
0 Likes
mjuricek1 Absent Member.
Absent Member.

Re: IDM 4.7 - how to call REST API by curl and JavaScript

thx! it helped.

also the following article is very helpful https://www.netiq.com/communities/cool-solutions/clean-identity-reporting-database-idm-4-5-using-rest/
But I cannot find a counterpart to Workflow process REST API (https://www.netiq.com/documentation/identity-manager-47/identity_apps_admin/data/bh8qaw9.html)

It looks that I am not able to migrate our custom workflow dashboard what we are using in UserApp 😞
0 Likes
avikram Absent Member.
Absent Member.

Re: IDM 4.7 - how to call REST API by curl and JavaScript

Milan,

Can you please refer to https://<your identity apps server>/idmappsdoc to refer to the REST api documentation!. The steps to authenticate have been documented as well over there.

Regards,
Aditya



mjuricek;2480306 wrote:
Hi guys,

New IDM 4.7 removes RIS and there is a new REST API (or there is a new way how to us it). And unfortunatelly, it is not clear to me how to authenticate and use the new REST API.
Do you have any example? (calling by curl or Javascript).

Before I used curl like this:
curl -v -H "Accept: application/json" -H "RESTAuthorization: dWFkbWluOm5vdmVsbA==" http://192.168.239.130:8180/RIS/v1/identities

and in JavaScript, I used sessions:

function obtainSessionSecret(aUserAppAddress){
var pObtainedSecret ="";
$.ajax({
type: "POST",
url: aUserAppAddress+"/RIS/v1/AuthorizationSession",
async: false,
beforeSend: function(request){
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
},
dataType: "json",
data:"{\"Authorization\":\"dWFkbWluOm5vdmVsbA==\"}",
success: function (response){
pObtainedSecret = ""+response.SessionSecret;
}
});
return pObtainedSecret;
}

Can you please send me an example how to create a session and get e.g. all users or all running WFs by REST and by curl?

btw. do I need to active REST API as in older IDM? (before I had to edit /opt/netiq/idm/apps/tomcat/webapps/RIS/WEB-INF/web.xml)

Thank you in advace for your help.

Regards,
Milan
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.