web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Parse specific fields ...
Power Automate
Unanswered

Parse specific fields from JSON response of Azure Devops REST API

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm working on a flow to read the error details from the build pipeline using Azure Devops connector and send an email with failure results.

I'm having trouble parsing the JSON output of build timeline API.
Timeline - Get - REST API (Azure DevOps Build) | Microsoft Learn

 

The output JSON format has multiple records with taskname, issue, and logs. How do I iterate through it and collect all failure reason in a Variable.

 

 "type""object",
    "properties": {
        "records": {
            "type": [
                "array"
            ],
            "items": {
                "type""object",
                "properties": {
                    ...
                    "details": {},
                    "errorCount": {
                        "type""integer"
                    },
                    "warningCount": {
                        "type""integer"
                    },
                    "url": {},
                    "log": {
                        "type": [
                            "object",
                            "null"
                        ],
                    "issues": {
                      ..
                    }
                    .... 
    }
}

Example PowerShell code for what I want:

 

# Get the response from the devops api
$response = Invoke-RestMethod ......
$errors = $response.records.Where({ $_.issues -ne $null })
$errors.ForEach({
 # Task name
 $_.name
 # Error message
 $_.issues.ForEach({ $_.message })
})

 

 

 

Categories:
I have the same question (0)
  • schwibach Profile Picture
    2 Moderator on at

    You'll want to use the Filter Array action and grab the records as content

    and then the field messages inside the issues.

    It'll look something like

    item()?['issues']?['message']

     

     

    Oh and you will probably want to use the empty() function and compare with if the expression true

  • hkr1990 Profile Picture
    Microsoft Employee on at

    How do I get the JSON output as an array

     

    hkr1990_0-1667349657208.png

     

  • schwibach Profile Picture
    2 Moderator on at

    In that field where it says body, you make reference not the entire object, but only the array within it that you want.

     

    In your case that expression will look something like this:

    body('HTTP')?['records']

     

    That would give you the content of the object records inside the body of the flow step HTTP.

     

    With the correct name of the previous flow step and a sample of the outputs of that step, we could put together the code.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard