cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stayinginsync
Advocate II
Advocate II

JSON not parsing correctly for Get HTTP Request (Groups Preview)

I'm having a discrepancy using the "Get HTTP Request" (Preview).  I'm pretty sure it is how I'm parsing the JSON and could use some assistance.

 

Test #1 (Works) - Get owners from a static group where I know what the <id> is, and add them as owners to a newly created group:

https://graph.microsoft.com/v1.0/groups/<groupid>/owners

 

Screen Shot 2022-03-27 at 2.17.45 PM.png

stayinginsync_0-1648646029127.png

 

{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "@@odata.type": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "businessPhones": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "displayName": {
                        "type": "string"
                    },
                    "givenName": {
                        "type": "string"
                    },
                    "jobTitle": {},
                    "mail": {
                        "type": "string"
                    },
                    "mobilePhone": {},
                    "officeLocation": {},
                    "preferredLanguage": {
                        "type": "string"
                    },
                    "surname": {
                        "type": "string"
                    },
                    "userPrincipalName": {
                        "type": "string"
                    }
                },
                "required": [
                    "@@odata.type",
                    "id",
                    "businessPhones",
                    "displayName",
                    "givenName",
                    "jobTitle",
                    "mail",
                    "mobilePhone",
                    "officeLocation",
                    "preferredLanguage",
                    "surname",
                    "userPrincipalName"
                ]
            }
        }
    }
}

stayinginsync_5-1648647229520.png

 

This works because, after parsing the JSON, the <id> (GUI) for each Owner is being parsed from the JSON and listed in the dynamic content box:

 

Screen Shot 2022-03-30 at 9.17.09 AM.png

 

Test #2 - Now, I need to get the Group ID for the Team I just created.  

 

stayinginsync_3-1648646627457.png

 

{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": [
                "string",
                "null"
            ]
        },
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "displayName": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mail": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "deletedDateTime": {},
                    "classification": {},
                    "createdDateTime": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "creationOptions": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "expirationDateTime": {},
                    "groupTypes": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "isAssignableToRole": {},
                    "mailEnabled": {
                        "type": "boolean"
                    },
                    "mailNickname": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "membershipRule": {},
                    "membershipRuleProcessingState": {},
                    "onPremisesDomainName": {},
                    "onPremisesLastSyncDateTime": {},
                    "onPremisesNetBiosName": {},
                    "onPremisesSamAccountName": {},
                    "onPremisesSecurityIdentifier": {},
                    "onPremisesSyncEnabled": {},
                    "preferredDataLocation": {},
                    "preferredLanguage": {},
                    "proxyAddresses": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "renewedDateTime": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "resourceBehaviorOptions": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "resourceProvisioningOptions": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "securityEnabled": {
                        "type": "boolean"
                    },
                    "securityIdentifier": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "theme": {},
                    "visibility": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "onPremisesProvisioningErrors": {
                        "type": "array"
                    }
                },
                "required": [
                    "id",
                    "deletedDateTime",
                    "classification",
                    "createdDateTime",
                    "creationOptions",
                    "description",
                    "displayName",
                    "expirationDateTime",
                    "groupTypes",
                    "isAssignableToRole",
                    "mail",
                    "mailEnabled",
                    "mailNickname",
                    "membershipRule",
                    "membershipRuleProcessingState",
                    "onPremisesDomainName",
                    "onPremisesLastSyncDateTime",
                    "onPremisesNetBiosName",
                    "onPremisesSamAccountName",
                    "onPremisesSecurityIdentifier",
                    "onPremisesSyncEnabled",
                    "preferredDataLocation",
                    "preferredLanguage",
                    "proxyAddresses",
                    "renewedDateTime",
                    "resourceBehaviorOptions",
                    "resourceProvisioningOptions",
                    "securityEnabled",
                    "securityIdentifier",
                    "theme",
                    "visibility",
                    "onPremisesProvisioningErrors"
                ]
            }
        }
    }
}

 

The flow runs properly and I get the exact output I expect.  The HTTP Request is filtered and only returns the output for the new group name. However, the <id> field for just /groups/ is not available as dynamic content. :

 

stayinginsync_1-1648587611610.png

stayinginsync_2-1648587646002.png

stayinginsync_3-1648587681473.png

 

I know it is there.  I see it in my Output.  I just can't pull it out.  I need the ID as dynamic content, or at the very least, as a string variable, so I can use it in other parts of the flow.

 

Thanks in advance.

 

 

3 REPLIES 3
tom_riha
Super User
Super User

Hello @stayinginsync ,

you could try to extract the value from the JSON directly using an expression. I prefer that solution as it gives you more control over what you're extracting and it doesn't create such a terrible mess among the dynamic contents.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

@tom_riha 

 

Thanks for the response.

 

That was what i wanted to do, and the first thing I tried (in fact I found that exact blog post in my research), but I couldn't figure out the right expression.  Whenever I tried any combination of either body() or triggerOutput(), with the following, I kept getting invalid expression.  I've lost track of how many different combinations I tried.

['value']?['id']

 

Thanks in advance.

 

 

VictorIvanidze
Community Champion
Community Champion

Try this:

body('Send_an_HTTP_request')?['value'][0]?['id']
--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,952)