【问题标题】:How to set HTTP header in MS Power Automate (Flow) custom connector using policy template如何使用策略模板在 MS Power Automate (Flow) 自定义连接器中设置 HTTP 标头
【发布时间】:2020-05-13 09:03:31
【问题描述】:

我正在尝试在 MS Flow 中创建一个自定义连接器(现在更名为 MS Power Automate)。我正在尝试使用连接中的值在我的操作请求中添加一个自定义标头,我阅读了使用策略模板可以做到这一点的文档:https://docs.microsoft.com/en-us/connectors/custom-connectors/policy-templates/setheader/setheader#input-parameters

这里微软提供的例子中,也是可以的:https://github.com/microsoft/PowerPlatformConnectors/blob/master/samples/Facebook/apiProperties.json

这是我在 apiProperties.json 中的设置方式。当用户第一次建立连接时,我会询问他们的 IP、用户名和密码。使用简单的身份验证类型。:

{
  "properties": {
    "capabilities": [],
    "connectionParameters": {
      "ip": {
        "type": "string",
        "uiDefinition": {
          "constraints": {
            "clearText": true,
            "required": "true",
            "tabIndex": 0
          },
          "description": "Your IP",
          "displayName": "IP",
          "tooltip": "Provide your IP"
        }
      },
      "username": {
        "type": "string",
        "uiDefinition": {
          "constraints": {
            "clearText": true,
            "required": "true",
            "tabIndex": 1
          },
          "description": "Your username",
          "displayName": "Username",
          "tooltip": "Provide your username"
        }
      },
      "password": {
        "type": "securestring",
        "uiDefinition": {
          "constraints": {
            "clearText": false,
            "required": "true",
            "tabIndex": 2
          },
          "description": "Your password",
          "displayName": "Password",
          "tooltip": "Provide your password"
        }
      }
    },
    "iconBrandColor": "#ff5c10",
    "policyTemplateInstances": [
      {
        "parameters": {
          "x-ms-apimTemplate-operationName": [
            "MyAction"
          ],
          "x-ms-apimTemplate-policySection": "Request",
          "x-ms-apimTemplateParameter.existsAction": "override",
          "x-ms-apimTemplateParameter.name": "IP",
          "x-ms-apimTemplateParameter.value": "@connectionParameters('ip')"
        },
        "templateId": "setheader",
        "title": "IP"
      }
    ]
  }
}

在 policyTemplateInstances 部分,您可以看到我将 IP 变量作为标头参数传递。

在 apiDefinitions 文件中,我将安全设置为基本:

  "securityDefinitions": {
    "undefined": {
      "type": "basic"
    }
  },

所以我遇到的错误是它实际上没有在动作标题中传递控制室ip,我做错了什么?

【问题讨论】:

    标签: json power-automate


    【解决方案1】:

    事实证明我的解决方案确实有效,将其留给未来的观众

    【讨论】:

      猜你喜欢
      • 2022-10-21
      • 1970-01-01
      • 1970-01-01
      • 2020-07-18
      • 2020-06-06
      • 2021-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多