Vice Admiral
Vice Admiral
128 views

Approve request using REST API

Since I was not able to use SOAP to approve request (either using forward or forwardAsProxy - see https://community.microfocus.com/t5/Identity-Manager-User/Error-calling-forwardAsProxy/m-p/2847717#M46801), I'm trying to do that using REST API.

Problem is that REST documentations is not something useful. Yes, we get URLs and possible field names, but no info regarding what values are accepted, how to prepare them...

My plan:

  1. get taskID from existing nrfRequest object
  2. get task data items using taskID obtained in step 1
  3. approve task using taskID and data items obtained in step 1 and step 2 (+ my own comment)

Step 1 was quite easy using SOAP (call getWorkEntries and pass nrfApprovalProcessId as requestId, result is in "id" element).

I cannot find such simple method using REST, so I used /tasks/list/others where only option was to pass q parameter with users full name and then loop over results. Is there a simpler way?

Anyway, at the end I got taskID

 

Step 2 was surprisingly simple, simply POST to /IDMProv/rest/access/tasks/item:

{"taskId":"<taskID obtained in step 1>"}

Result is JSON, like this:

{
	"taskId": ...,
	"processName": ...,
	"processId": ...,
	"createTime": ...,
	"recipient": ...,
	"initiator": ...,
	...
}

 

For Step 3 I'm trying use POST to /IDMProv/rest/access/tasks, as described here:

https://www.netiq.com/documentation/identity-manager-developer/rest-api-documentation/idmappsdoc/#/Access/resource_Access_performTaskAction_POST

Payload like this:

{
"tasks": [<JSON received in Step 2>],
"action": "approve",
"comment": "Test approve2 using REST"
}

But unfortunately all I get back is HTTP/400 - Bad request. No explanation what is wrong, also nothing useful in catalina.out (logging configuration is set to TRACE for all listed packages)

 

Anybody has any example on what should be in payload for step 3? Or am I completely misunderstanding REST documentation?

 

Kind regards,

Sebastijan

 

PS: I have used fiddler to see what's going on when using browser. In that case browser is calling /rest/access/tasks/v2 using /WFHandler URL. And /rest/access/tasks/v2 is completely undocumented (https://www.netiq.com/documentation/identity-manager-developer/rest-api-documentation/idmappsdoc/#/Access/resource_Access_submitFormDetails_POST)...

Labels (1)
0 Likes
0 Replies
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.