Gogutz
Gogutz

Reputation: 2055

How can I get a property value from the header of a Logic Apps response?

I have created a small Logic App that queries CDS. The response is chunked and I need the value of the property "x-ms-request-id" from "headers".

{
    "statusCode": 200,
    "headers": {
        "Pragma": "no-cache",
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "x-ms-request-id": "some-guid",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "Cache-Control": "no-store, no-cache",
        "Date": "Tue, 15 Sep 2020 07:48:56 GMT",
        "Set-Cookie": "ARRAffinity=something;Path=/;HttpOnly;Domain=commondataservice-cus.azconn-cus.p.azurewebsites.net",
        "Content-Type": "application/json; charset=utf-8; odata.metadata=minimal",
        "Expires": "-1",
        "Content-Length": "3498648"
    },
    "body": {
        "@odata.context": "some url",
        "value": [....],
        "@odata.nextLink": "another url"
    }
}

I have tried using @triggerOutputs()?['headers']?['x-ms-request-id'] without any success.

Set variable

When the Logic App runs the variable token gets assigned the null value. enter image description here

Upvotes: 1

Views: 2026

Answers (1)

Hury Shen
Hury Shen

Reputation: 15724

You can get value of "x-ms-request-id" in headers by the expression below:

outputs('List_records')?['headers']?['x-ms-request-id']

Upvotes: 3

Related Questions