README revision 4b3769ce483ece06f60f983193712492b920144f
Async reconciliation Sample
---------------------------
Copyright (c) 2012 ForgeRock AS
This work is licensed under a Creative Commons Attribution-
NonCommercial-NoDerivs 3.0 Unported License. See
http://creativecommons.org/licenses/by-nc-nd/3.0/
This sample demonstrates how to perform an asynchronous action from a
reconciliation.
For documentation pertaining to this example see:
http://openidm.forgerock.org/doc/install-guide/index.html#more-sample9
To try the sample, follow these steps.
1. Start OpenIDM with the configuration for sample 9.
$ cd /path/to/openidm
$ ./startup.sh -p samples/sample9
2. Run reconciliation.
$ curl -k -u openidm-admin:openidm-admin -X POST "https://localhost:8443/openidm/recon?_action=recon&mapping=systemXmlfileAccounts_managedUser"
4. The reconciliation starts an approval workflow for each ABSENT user.
These workflows (managedUserApproval) wait for approval.
5. Query the started workflow task instances.
$ curl -k -u openidm-admin:openidm-admin "https://localhost:8443/openidm/workflow/taskinstance?_queryId=query-all-ids"
sample response:
{"result":[
{"createTime":"2014-02-19T12:45:21.256+01:00","suspensionState":1,"executionId":"4",
"assignee":"openidm-admin","cachedElContext":null,"delegationStateString":null,
"activityInstanceVariables":{},"deleted":false,"suspended":false,"_rev":1,"revisionNext":2,
"processInstanceId":"4","_id":"16","priority":50,"description":null,"taskDefinitionKey":"evaluateRequest",
"name":"Evaluate request","owner":null,"eventName":null,"processDefinitionId":"managedUserApproval:1:3",
"parentTaskId":null,"dueDate":null,"delegationState":null}
],"resultCount":1,"pagedResultsCookie":null,"remainingPagedResults":-1}
6. Approve the request.
$ curl -k -u openidm-admin:openidm-admin -X POST "https://localhost:8443/openidm/workflow/taskinstance/16?_action=complete" --data '{"requestApproved": "true"}' -H "Content-Type: application/json"
7. Query the managed users created by the asynchronous reconciliation after
the approval step.
$ curl -k -u openidm-admin:openidm-admin "https://localhost:8443/openidm/managed/user?_queryId=query-all-ids"
sample response:
{"result":[{"_id":"1","_rev":"0"}],"resultCount":1,"pagedResultsCookie":null,"remainingPagedResults":-1}
To test the sample you might want to copy the following into an executable text file and run it:
curl -k -u openidm-admin:openidm-admin -X POST "https://localhost:8443/openidm/recon?_action=recon&mapping=systemXmlfileAccounts_managedUser"
sleep 3
echo ""
curl -k -u openidm-admin:openidm-admin "https://localhost:8443/openidm/workflow/taskinstance?_queryId=query-all-ids"
echo ""
echo "now run the following after replacing XX with the taskinstanceNumber (the _id property) from above!"
echo 'curl -k -u openidm-admin:openidm-admin -X POST "https://localhost:8443/openidm/workflow/taskinstance/XX?_action=complete" -H "Content-Type: application/json" --data '\''{"requestApproved": "true"}'\'