Network Engineer in an early learning state.
I am trying to create a workflow where I do a GET on an API and want to parse the body for a specific key value pair and store that as a variable. Seems easy enough but the hard part (at least for me) is the GET returns several objects with the same key name and is represented several times throughout the body.
Example:
{
“Rules”: [
{
“ruleId”: ABC123,
“ruleName”: “Alert Rule A”
},
{
“ruleId”: CDF456,
“ruleName”: “Alert Rule B”
},
{
“ruleId”: EFG789,
“ruleName”: “Alert Rule C”
},
]
}
What I would love to do here is parse the body for “Alert Rule C” and set a variable for ruleID = EFG789. The “ruleName” is a constant, the “ruleID” changes. So I know I can always match “ruleName”. In a perfect state, I want to do this to 5 different objects in the body and create 5 variables I can call in subsequent POST requests.
If someone can point me in the right direction Im sure I can figure it out, I just have not had a ton of luck googling with my search terms. Thank you!