mjuricek1

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-05-03
11:10
1936 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
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
3 Replies
klasen

Micro Focus Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-05-04
07:54
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
>
> 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
Norbert
mjuricek1

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-05-10
08:18
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 😞
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 😞
avikram

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-05-14
12:15
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
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