Split results from JSON Outputs

Bartosz Wysocki 50 Reputation points
2024-07-27T16:29:36.24+00:00

In Azure Logic Apps I am trying to get Teams ID after creating it from the HTTP request. I then used Compose (headers) to see the results.

User's image

The outputs will look as follows :

{
    "Location": "/teams('AAA-BBB-CCC-DDD')/operations('AAAA-BB-CCC-DDD')",
    "Strict-Transport-Security": "max-age=31536000",
    "request-id": "CCC-CCCC-CCC-CCCC",
    "client-request-id": "CCCC-CCCC-CCCC",
    "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"UK South\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"004\",\"RoleInstance\":\"LO1PEPF0000323A\"}}",
    "Date": "Sat, 1 Jul 2024 16:20:34 GMT",
    "Content-Location": "/teams('AAA-BBB-CCC-DDD')",
    "Content-Length": "0"
}

What I am trying to achieve is to extract the Teams ID from the outputs so I can use it in "set-variable", TeamsID will be different for each run so I need to set it up as dynamic.

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bartosz Wysocki 50 Reputation points
    2024-07-28T08:31:29.91+00:00

    Add below to a Set Variable function to split the results.

    @{split(split(body('Your_Logic_App_HTTP_Request')?['Location'], '/')?[1], '''')?[1]}

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.