Rocket Singh
Rocket Singh

Reputation: 519

Save the Response from HTTP to Blob Storage using Azure Logic App

Is it possible to save the response from the HTTP request(First Step) into the Blob Storage(Second Step) while using Azure Logic App.

Thank you.

Upvotes: 5

Views: 6278

Answers (2)

Jayendran
Jayendran

Reputation: 10960

Yes, You can achieve it by using Http and Create blob task. enter image description here

Code

{
    "$connections": {
        "value": {
            "azureblob": {
                "connectionId": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/connections/azureblob",
                "connectionName": "azureblob",
                "id": "/subscriptions/xxx/providers/Microsoft.Web/locations/xxx/managedApis/azureblob"
            }
        }
    },
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Create_blob": {
                "inputs": {
                    "body": "@triggerBody()",
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/datasets/default/files",
                    "queries": {
                        "folderPath": "/testing",
                        "name": "Test",
                        "queryParametersSingleEncoded": true
                    }
                },
                "runAfter": {},
                "runtimeConfiguration": {
                    "contentTransfer": {
                        "transferMode": "Chunked"
                    }
                },
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "HTTP": {
                "inputs": {
                    "method": "GET",
                    "uri": "https://reqres.in/api/users?page=2"
                },
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "type": "Http"
            }
        }
    }
}

Update 1:

Just update your blob name with the expression like utcNow('yyyyMMdd')

enter image description here

Upvotes: 6

DTRT
DTRT

Reputation: 11040

Presuming you have no extraordinary circumstances, yes, you for sure can save the Request content to a Blob. Any Content really.

You will start with the Create Blob Action specifying the Trigger Body as the content.

Don't over think it, it's the same pattern as saving to a local file.

Upvotes: 0

Related Questions