I’ve been working on triggering LCM workflows through external API calls. Has anyone used OKHttp libraries for this?
I have a working flow through Postman and Python script. Looking to build the flow in Java. Very basic at this point - calling ‘LCM Create and Update’, single attribute update. Works great in my Postman and Python flows, generates the “Resource Workflow null not found” with the “404” standard error code with my Java code. I pulled the sample OKHttp code from the developer doc site (update-user | SailPoint Developer Community). I’ve tweaked the code to match my test case - with the necessary updates for target URL and credentials. Seems the ‘workflowName’ element in the JSON string isn’t being parsed correctly.
Very probable it’s me (usually is), still reviewing the code. Just posting for a sanity/validation check, specifically around the implementation with OKHttp. Appreciate any insights. Will share updates from my side when progress is made.
This is IIQ 8.3, running in my Seri test environment.
The error suggests there is an issue with the request body. If possible, could you please share the request body that you are passing to the Java code?
It does indeed. I’ve attached both the Python script (working) and the Java file (not working).
I set up a mock server in Postman and the payload received is different between the two, copied the request body for both below. The Java code is an edited version of the sample provided in the doc.
I have tested without the authorization, get the expected 401 error.
I’m also able to run GET operations with no issue, through standard Java. I’m happy to check additional items, depending on your additional review.
I would expect the body of the request to be the same, once processed through whatever source - but as shown the JSON presented through the Python script is different than that through Java. Thoughts?
I encountered a similar issue when using your code to launch the LCM workflows. The problem seems to be with the request body. I was able to successfully launch the workflow using the request body provided below. I have added the yellow highlighted line and launched the workflow. Could you please try with this and let me know?
One query I have, can we use similar concept in IdentityNow to trigger workflow using okhttp. what kind of changes need to require if we use same in IDN.
The sample script for OkHttp, and perhaps Unirest, provided in the developer doc should be reviewed. The output, as we’ve seen, doesn’t provide the required json object notation.
It needed a bit of messaging and your testing Arun helped me reevaluate. I rebuilt the json body, making it match the working output seen through my mock server in Postman.
I’ve attached the working script.
Thanks for assist and knocking things around.
For reference, below are now matching request body of the outputs, from both the Python initiated request and the Java OkHttp.
To be clear, I captured the output through my Postman server, but also confirmed it works in my SailPoint environment. Workflow and approvals are kicked off.
Thanks to @colin_mckibben for applying code formatting to the presented JSON strings. Makes any copy/paste obviously more efficient. I will make sure to leverage in the future.