cancel
Showing results for 
Search instead for 
Did you mean: 

IDM Rest API question

Former Member
0 Kudos

Hello all,

I'm currently designing some UI fro IDM using Rest API v2 and and for one report I need a solution to query the API so that it would return the list of ALL request pending approval (not the "Get Open Approval Requests for Current User" which is obtained by calling "/idmrestapi/v2/service/TaskCollection").

The idea behind is that the service-center will be able to quickly check status of pending request for a specific user.

Could not find anything in the documentation regarding this. Anywone already did this ?

Regards,

Emmanuel.

Accepted Solutions (1)

Accepted Solutions (1)

former_member2987
Active Contributor

HI Emmanuel,

I'm not an expert on the Rest API, but my understanding is that if you have a task to create that report, you should be able to reference it via the API.  However if it's an IDM report, that might not be supported.

I'm wondering if , , or might have any ideas...

Former Member
0 Kudos

Hi Matt,

This seems to be the solution ! I tried with existing reports and was able to retrieve the data with
/idmrest/v72alpha/entries/<MSKEY>/tasks/0/attributes/<attribute name>

initially tried something like :

/idmrestapi/v2/service/TASK_ATTRIBUTES?TASK_GUID=guid'<report guid>'

but only got "Could not map task GUID xxxxxxxx to task ID" wich might need some more ivestigation I guess, but since the first solution looks to be ok, i'll stick with this one .

Looks like that with few API call it's possible to retrieve the report, just need to process it in the UI to have a pretty display.

Will update the solution when it's fully working.

former_member2987
Active Contributor
0 Kudos

Hi Emmanuel,

Great to hear.  Please update us and award points for helpful answers and mark as closed when complete!

Thanks,

Matt

Former Member
0 Kudos

mmm, ok almost there but I'm still facing some issues.

First the proper API query to run seems to be "/idmrestapi/v2/service/ET_MX_REPORT", that will give the list of reports.

Interestingly the query "/idmrest/v72alpha/entries?EntryType=MX_REPORT" gives a list of old reports no longer available... Looks like the IDM installation has been migrated and the "v72alpha" API is still linked to some old data somehow. Too bad as I did the UI to use those query and it worked pretty well to retrieve list of reports and display them 😞

I can obtain information on a specific report by running :

/idmrestapi/v2/service/ET_MX_REPORT(id=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')

And I do see the reports I just ran.

And then to access a specific report, I should be able to obtain it via

idmrestapi/v2/service/ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_Z_ENTITY_UPLOAD_FILE

or (not sure yet)

idmrestapi/v2/service/ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_MX_REPORT_RESULT

(those both comes form the header of the previous request :

<link rel="edit" title="ET_MX_REPORT" href="ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')"/>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ER_MX_OWNER" type="application/atom+xml;type=feed" title="ER_MX_OWNER" href="ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/ER_MX_OWNER"/>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ER_MX_REPORT_ENTRY" type="application/atom+xml;type=feed" title="ER_MX_REPORT_ENTRY" href="ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/ER_MX_REPORT_ENTRY"/>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/BI_MX_REPORT_RESULT" type="application/atom+xml;type=feed" title="BI_MX_REPORT_RESULT" href="ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_MX_REPORT_RESULT"/>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/BI_Z_ENTITY_UPLOAD_FILE" type="application/atom+xml;type=feed" title="BI_Z_ENTITY_UPLOAD_FILE" href="ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_Z_ENTITY_UPLOAD_FILE"/>

However the answer I get is

MX_REPORT_RESULT is not a task attribute of task FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF


So I tried to use the task GUID of the report (from identity-center, right-click the report name and "get job GUID"), but then I get :

Could not map task GUID 0EA6D0A8-9DEC-497E-9AD0-EF02B6B7E354 to task ID

Same if I run the query "/idmrestapi/v2/service/ET_MX_REPORT(ID=57860,TASK_GUID=guid'0EA6D0A8-9DEC-497E-9AD0-EF02B6B7E354')" instead of "/idmrestapi/v2/service/ET_MX_REPORT(id=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')"


I might be missing something here.


jrondorf
Participant
0 Kudos

Check out

/idmrestapi/v2/service/ET_MX_REPORT(ID=57860,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_MX_REPORT_RESULT/$value

But maybe with the correct Task ID and not FFF

Former Member
0 Kudos

Hello,

as promised, I'm back with some progress (success in fact !)

The need was to have some sort of "report viewer" UI (made out of Javascript and various js libs like AngularJS).

The result is an UI that will extract the list of IDM reports an populate a drop-down list that allows you to select "the report type". For each "report type" it will also extract the list of report version and allows you to display this specific verion of the report. I also made a direct access to the latest version of a specific report type by passing this report type in the URL as a parameter.

So to explain how I did this :

- Create a report in Identity Manager

- Query the API with  /idmrest/v72alpha/entries?EntryType=MX_REPORT

that will list the available reports in this form :

{

  "MX_REST_SUCCESS": true,

  "ENTRIES": [{

  "DISPLAYNAME": "Report bla bla bla",

  "MX_REST_URI": "http://<servername>:50000/idmrest/v72alpha/entries/22419",

  "MSKEY": 22419,

  "MSKEYVALUE": "REPORT:SOME_REPORT_ID:2014-07-31T12:58:35",

  "Z_REPORT_CODE": ""

  },

  {

  "DISPLAYNAME": "Report bla bla bla 2",

  "MX_REST_URI": "http://<servername>:50000/idmrest/v72alpha/entries/22421",

  "MSKEY": 22421,

  "MSKEYVALUE": "REPORT:SOME_REPORT_ID:2014-07-31T15:10:39",

  "Z_REPORT_CODE": ""

}]

}

--> retrieve the DISPLAYNAME and sort/filter/group then as report type.

--> retrieve the MSKEY/MSKEYVALUE for each DISPLAYNAME (report-type) that will be the "Report version". The key is "MSKEY", that will be used in a second API request to extract one specific report.

So basically retrieve the report mskey, and then you can extract the report you're looking for via :

/idmrest/v72alpha/entries/<MSKEY of the report>/tasks/0/attributes/Z_REPORT_FILE

Z_REPORT_FILE is a general attribute defined in HCM Staging Area / identity store schema / attributes) and is enabled for MX_REPORT entry type.

In fact this part was already done for some reporting purpose, so I did not have to take care about it.

After that it's just a question of formating this for display.... Remember when you create the report in identity center to use CSV, include the header.

To format the display output retrieve the first line of your report, split it, remove the " that are around the values and you just have to create a table with those columns names.

Then just loop through the report lines to display them in the table. ui-grid and AngularJS are great for such things, very flexible (don't know about SapUI5 as the pre-requisit was to NOT USE ui5 🙂 )

My approach using the V2 API failed, but I think this is linked to the system installation. I experienced also some issues with V72alpha on the DEV system, while it's working flawlessly on PROD system.

However this (using V2 API) should work but i'm unable to confirm. The drawback of using the V2 API, is that you cannot easily extract the list of all reports, populate your drop-down selection list as you have to address the report via it's taskGUID while, with the V72apha API you address the report via it's MSKEY obtained by a first API request.

If you need to create one specific report and display only this one, then V2 should work as suggested. I felt more flexible to have a generic report viewer that would work for any report, so that you won't have to change anything on the UI if you change/modify your report, and it's re-usable.

Emmanuel.

Answers (2)

Answers (2)

normann
Advisor
Advisor
0 Kudos

Hi Emmanuel,

if you dont find any official way here is a workaround:

1. You define a query that gives you the required information from the database.

2. You create a custom attribute Z_ALL_OPEN_APPROVALS and put the SQL from 1. into value help whereby you can resolve the mskey of the calling user as %ADMINMSKEY%.

3. You receive the value help of that attribute in your UI.

Cheers

Norman

jrondorf
Participant
0 Kudos

Yes, forget about that, that is definitely possible in order to create a report.

jrondorf
Participant
0 Kudos

This is not possible AFAIK.

Former Member
0 Kudos

Hi Jannis,

Unfortunately this does not work.

I checked both :

/idmrestapi/v2/service/ET_MX_REPORT(ID=68167,TASK_GUID=guid'0EA6D0A8-9DEC-497E-9AD0-EF02B6B7E354')/BI_MX_REPORT_RESULT/$value

and

/idmrestapi/v2/service/ET_MX_REPORT(ID=68167,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')/BI_MX_REPORT_RESULT/$value


and I got the "Could not map task GUID ..(FFF or the proper task guid here).... to task ID" for both


Yet I did not try to create the report myself and used reports that were created previously. But I find the output csv file in the reporting folder when I run the report (with some data), so I guess they do work properly.



I still don't get it why I can get an answer with

ET_MX_REPORT(ID=68167,TASK_GUID=guid'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')

(which will get me the description of the report)


while this does not work with the proper GUID for this report ID:

ET_MX_REPORT(ID=68167,TASK_GUID=guid'0EA6D0A8-9DEC-497E-9AD0-EF02B6B7E354')

("Could not map task GUID ....")

Could it have something to do with the MX_RECORD entry type ? or some MX_RECORD related attributes ?


Also IDM is running on a pretty old SP (SP4), might have to start looking for some notes at this point as well.