Azure Logic App - Dynamic API Connection

2019-07-18 17:59发布

问题:

Is it possible to dynamically choose the FTP API connection that I want to use? We have defined two FTP API connections in the same resource group, with name ftptest1 and ftptest2.

How can I select one of these in the code view of the Logic App? I'm only able to select the connection in the designer and then connection 'ftp' is created. See code snippet below.

But I need to dynamically select one of the two FTP connections based on a parameter.

"inputs": {
            "body": "@body('XMLFile')",
            "host": {
                "api": {
                    "runtimeUrl": "https://logic-apis-westeurope.azure-apim.net/apim/ftp"
                },
                "connection": {
                     "name": "@parameters('$connections')['ftp']['connectionId']"
                }
            },

Is it possible to change the "@parameters('$connections')['ftp']['connectionId']" and select an existing API Connection there by name or something else?

Thank you!

回答1:

You should add a condition after which there will two FTP connectors each using different connection. This should make it dynamic. There is no charge on how many actions are in the definition. We charge on the basis of action execution which in this case will be counted one (either ftp1 or ftp2).