Goal: retrieve data from Insight Platform API Get Users (or other arbitrary JSON sources) and run a Loop step on each member of the JSON array.
Problem: A Loop Step requires an InsightConnect array - you can’t specify an arbitrary object as it’s a dropdown - but I’ve not been able to figure out a way to transform the JSON I have into an object which the Loop step will recognize as something to loop over.
For example, here’s what the body_object output of an HTTP REST API query to the InsightIDR users API endpoint looks like:
{
"object": [
{
"email": "user0.lastname@organization.domain",
"federated": true,
"first_name": "user0",
"id": "000bb000-ec0a-0000-b000-000c00d0000c",
"last_login": null,
"last_name": "lastname",
"platform_admin": false,
"status": "ACTIVE",
"timezone": "Europe/Rome"
},
{
"email": "User1.Lastname@organization.domain",
"federated": true,
"first_name": "User1",
"id": "00a000a0-0bce-0000-bc0d-00000aaa000a",
"last_login": "0000-00-00T00:00:00Z",
"last_name": "Lastname",
"platform_admin": false,
"status": "ACTIVE",
"timezone": "UTC"
},
{
"email": "user2.lastname@organization.domain",
"federated": true,
"first_name": "user2",
"id": "00e0f00d-c000-0a00-b000-0a0000ddb000",
"last_login": "0000-00-00T00:00:00Z",
"last_name": "lastname",
"platform_admin": false,
"status": "ACTIVE",
"timezone": "UTC"
}
]
}
How do I get InsightConnect to acknowledge that this is a repeating data structure which I’d like to iterate over? Is there some jq magic? A plugin which will convert this into an array? Something else?
The Loop Step documentation has a lot of useful info on how Loop Step outputs work, but almost nothing on inputs, so I’m stuck.
While we’re here: does anyone knows how to get this structure into a Python Script plugin step, or does the params.get call require that the Python Script plugin receives a dict with named keys as input?