3
votes

In an Azure App-Service Logic App I have an AzureStorageBlobConnector which retrieves a file from storage. The file is being retrieved as binary and without setting any ContentTransferEncoding. My connector definition (subscription details replaced with 'x') looks like this:

"azurestorageblobconnector": {
            "type": "ApiApp",
            "inputs": {
                "apiVersion": "2015-01-14",
                "host": {
                    "id": "/subscriptions/x/providers/Microsoft.AppService/apiapps/azurestorageblobconnector",
                    "gateway": "https://x.azurewebsites.net"
                },
                "operation": "GetBlob",
                "parameters": {
                    "BlobPath": "@triggers().outputs.body.Properties['FilePath']",
                    "FileType": "Binary"
                },
                "authentication": {
                    "type": "Raw",
                    "scheme": "Zumo",
                    "parameter": "@parameters('/subscriptions/x/resourcegroups/x/providers/Microsoft.AppService/apiapps/azurestorageblobconnector/token')"
                }
            },
            "repeat": null,
            "conditions": []
        },

I want to author a custom Api Connector to receive this file, make some changes to it, then return it for the next step in the workflow.

What form will the file be in when the storage blob connector passes it to the next connector as @body('azurestorageblobconnector').Content? Will it be HttpPostedFile or a Stream or Multipart content in the body, or something else?

1

1 Answers

2
votes

It depends on how you configure the Connector, if you choose "Binary" then it will come as a string in Base64 encoded. If you choose Text, then it will be "the raw text".

One way to deal with that, is in your API App try to Convert.FromBase64String and if that succeeds then you got yourself a byte array with the actual bytes. If it does not succeed then you can assume that is the raw text content of the file.