Return additional custom data with Azure Logic App async 202 response

96 views Asked by At

I have an HTTP Request-triggered Logic App that assigns an ID to each request payload and stores it in table storage. The Logic App uses an async Response so the client can fire-and-forget it. However, I would like to be able to pass the created ID back to the client in the 202 response. That way the client can store/log the ID to be able to find the associated table storage data later for status checking, replays, or just debug tracing. Is it possible to add custom data to the 202 response?

I understand the response includes a location header with the polling URL, but would still like to get the ID without having to poll. But how long will this polling URL remain valid? Could it still give you the result, say, a year later?


Edit: When adding the ID to the Response Body, it is not returned with the 202 response. That body (and custom headers) are only returned by the status polling response once the app completes. Here is an example of the 202 response

{
"properties": {
    "waitEndTime": "2023-11-02T18:14:39.9143394Z",
    "startTime": "2023-11-02T18:14:39.9143394Z",
    "status": "Running",
    "correlation": {
        "clientTrackingId": "12341234123412341234123412341234"
    },
    "workflow": {
        "id": "/workflows/.../versions/08512341234123412341",
        "name": "08512341234123412341",
        "type": "Microsoft.Logic/workflows/versions"
    },
    "trigger": {
        "name": "manual",
        "inputsLink": {
            "uri": "https://prod-28.centralus.logic.azure.com:443/workflows/.../runs/12341234123412341234123412341234/contents/TriggerInputs?api-version=2016-10-01&se=2023-11-02T22%3A00%3A00.0000000Z&sp=%2Fruns%12341234123412341234123412341234%2Fcontents%2FTriggerInputs%2Fread&sv=1.0&sig=...",
            "contentVersion": "ypjhVecnsHtFi5cxo/hiWA==",
            "contentSize": 256,
            "contentHash": {
                "algorithm": "md5",
                "value": "ypjhVecnsHtFi5cxo/hiWA=="
            }
        },
        "outputsLink": {
            "uri": "https://prod-28.centralus.logic.azure.com:443/workflows/.../runs/12341234123412341234123412341234/contents/TriggerOutputs?api-version=2016-10-01&se=2023-11-02T22%3A00%3A00.0000000Z&sp=%2Fruns%12341234123412341234123412341234%2Fcontents%2FTriggerOutputs%2Fread&sv=1.0&sig=...",
            "contentVersion": "QGt+/SWzwhQz+hPxukjkw7==",
            "contentSize": 2052,
            "contentHash": {
                "algorithm": "md5",
                "value": "QGt+/SWzwhQz+hPxukjkw7=="
            }
        },
        "startTime": "2023-11-02T18:14:39.8969631Z",
        "endTime": "2023-11-02T18:14:39.8969631Z",
        "originHistoryName": "12341234123412341234123412341234",
        "correlation": {
            "clientTrackingId": "12341234123412341234123412341234"
        },
        "status": "Succeeded"
    },
    "outputs": {
    },
    "response": {
        "startTime": "2023-11-02T18:14:39.9126185Z",
        "correlation": {
        },
        "status": "Waiting"
    }
},
"id": "/workflows/.../runs/12341234123412341234123412341234",
"name": "12341234123412341234123412341234",
"type": "Microsoft.Logic/workflows/runs"

}


This is the workflow.
enter image description here

Importantly, I have the Asynchronous Response setting enabled.
enter image description here

1

There are 1 answers

3
Skin On

By using the Response operation, you can simply reply to the calling application and pass in any and all information back to the calling application that you have on hand at the time.

Flow

This is the response from Postman ...

Response