【问题标题】:Send workflow information to custom connector将工作流信息发送到自定义连接器
【发布时间】:2018-02-11 14:22:38
【问题描述】:

在将工作流信息发送到自定义连接器的调用标题/正文中时,我需要帮助。我正在尝试使用从 API 调用返回的值在逻辑应用的参数之一中加载下拉列表。 API 端点需要基本工作流信息,例如资源组和工作流名称,这些信息通常在逻辑应用执行的 http 请求标头中提供。

通常当我在逻辑应用的 json 中使用 @{workflow().name} 时,它会替换为工作流名称。在自定义连接器的情况下,WDL 语法按原样传递,无需任何转换。

这是一个包含所有相关部分的简化的 swagger json。

{
    "swagger": "2.0",
    "info": {
        "title": "{{dynamicHostName}}",
        "version": "1.0.0"
    },
    "host": "{{dynamicHostName}}",
    "basePath": "/",
    "schemes": [
        "https"
    ],
    "paths": {
        "/sftpsource": {
            "post": {
                "operationId": "SftpSource",
                "summary": "Sftp as source system",
                "description": "Use Sftp as source system",
                "produces": [
                    "application/json"
                ],
                "consumes": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "params",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object",
                            "properties": {
                                "hostName": {
                                    "type": "string",
                                    "x-ms-summary": "Host Name",
                                    "x-ms-visibility": "advanced"
                                },
                                "portNumber": {
                                    "type": "string",
                                    "x-ms-summary": "Port Number",
                                    "x-ms-visibility": "advanced"
                                },
                                "userName": {
                                    "type": "string",
                                    "x-ms-summary": "User Name",
                                    "x-ms-visibility": "advanced"
                                },
                                "password": {
                                    "type": "string",
                                    "x-ms-summary": "Password",
                                    "x-ms-visibility": "advanced"
                                },
                                "filePath": {
                                    "type": "string",
                                    "x-ms-summary": "File Path"
                                },
                                "system": {
                                    "type": "string",
                                    "x-ms-visibility": "advanced",
                                    "x-ms-summary": "System",
                                    "x-ms-dynamic-values": {
                                        "operationId": "GetTaggedSystems",
                                        "parameters": {
                                            "workflow-name": "@{workflow().name}"
                                        },
                                        "value-path": "systemId",
                                        "value-title": "systemName"
                                    }
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Request is queued"
                    },
                    "500": {
                        "description": "Server Error"
                    }
                }
            }
        },
        "/taggedSystems" : {
            "get": {
                "operationId": "GetTaggedSystems",
                "summary": "Tagged Systems",
                "x-ms-visibility": "advanced",
                "description": "Get all systems tagged to this flow",
                "parameters": [
                    {
                        "name": "workflow-name",
                        "in": "header",
                        "required": true,
                        "type":  "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/TaggedSystems"
                        }
                    },
                    "202": {
                        "description": "Work is still in progress"
                    },
                    "500": {
                        "description": "An error occured while trying to fetch tagged systems."
                    }
                }
            }
        }
    },
    "definitions": {
        "TaggedSystems": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "systemId": {
                        "type": "string"
                    },
                    "systemName": {
                        "type": "string"
                    }
                },
                "required": [
                    "systemId",
                    "systemName"
                ]
            }
        }
    }
}

【问题讨论】:

    标签: azure-logic-apps openapi


    【解决方案1】:

    您可以将内部参数定义为标头/正文,在其中您可以在执行流程时从工作流环境中传递您需要的动态表达式。

    有关流程的完整信息,您可以将@{workflow()} 作为内部参数传递。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-25
      相关资源
      最近更新 更多