使用Azure Logic App将响应从HTTP保存到Blob存储

时间:2018-08-07 12:08:22

标签: azure azure-storage azure-storage-blobs azure-logic-apps

使用Azure Logic应用程序时是否可以将来自HTTP请求(第一步)的响应保存到Blob存储(第二步)中。

谢谢。

2 个答案:

答案 0 :(得分:0)

假设您没有特殊情况,是的,您确定可以将请求内容保存到Blob。确实有任何内容。

您将从创建Blob动作开始,将触发器主体指定为内容。

请不要过度思考,这与保存到本地文件的方式相同。

答案 1 :(得分:0)

是的,您可以使用HttpCreate blob任务来实现。 enter image description here

代码

{
    "$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"
            }
        }
    }
}

更新1:

只需使用utcNow('yyyyMMdd')这样的表达式来更新您的Blob名称

enter image description here