Microsoft Flow自定义连接器webhook触发器定义和实现:创建流后找不到404 [英] Microsoft Flow Custom Connector webhook trigger definition and implementation : 404 not found after flow creation

查看:156
本文介绍了Microsoft Flow自定义连接器webhook触发器定义和实现:创建流后找不到404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Microsoft Flow中的API创建自定义连接器,以便用户可以基于webhook实现触发流. 身份验证部分似乎工作正常(我能够创建连接).使用我的自定义触发器创建流后,就永远不会触发它.在检查我这一端的数据时,Flow似乎永远无法正确注册订阅.
如果导航到该流程的管理页面,则会收到以下错误消息.
当我单击修复触发器时,会得到以下详细信息,其中Id参数与我们要订阅的资源的ID相匹配.
这是触发器定义:

I'm trying to create a custom connector for my API in Microsoft Flow so users can trigger flows based on a webhook implementation. The authentication part seems to be working properly (I'm able to create connections). After creating a flow using my custom trigger, it never gets triggered. When checking the data on my end it seems that Flow was never able to register the subscription properly.
If I navigate to the management page for the flow, I get the following error message.
When I click on fix the trigger I get the following details where the Id parameter matches the id of the resource we're trying to subscribe to.
Here is the trigger definition:

{
"/AlertRules/{id}/webhooks": {
      "x-ms-notification-content": {
        "schema": {
          "type": "object",
          "properties": {
            "Title": {
              "type": "string",
              "description": "Title"
            },
            "Text": {
              "type": "string",
              "description": "Text"
            },
            "Data": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/DataApi.Models.AlertEvent"
              },
              "description": "Data"
            }
          }
        },
        "description": ""
      },
      "post": {
        "responses": {
          "201": {
            "description": "Created",
            "schema": {
                "type": "string"
            }
          }
        },
        "x-ms-trigger": "single",
        "operationId": "NewAlertEvent",
        "summary": "When a new Alert Event is created or updated",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string",
            "x-ms-visibility": "important",
            "x-ms-dynamic-values": {
              "operationId": "AlertRules.AlertRule.ListAlertRule",
              "value-path": "Id",
              "value-collection": "value",
              "value-title": "Description"
            }
          },
          {
            "name": "body",
            "in": "body",
            "required": false,
            "schema": {
              "type": "string",
              "x-ms-visibility": "internal",
              "title": "",
              "x-ms-notification-url": true
            },
            "x-ms-visibility": "internal"
          }
        ]
      }
}

我的删除操作的说明

{
"/AlertRuleSubscriptions({Id})": {
"delete": {
        "tags": [
          "AlertRuleSubscriptions.AlertRuleSubscription"
        ],
        "summary": "Delete entity from AlertRuleSubscriptions",
        "operationId": "AlertRuleSubscriptions.AlertRuleSubscription.DeleteAlertRuleSubscription",
        "parameters": [
          {
            "in": "path",
            "name": "Id",
            "description": "key: Id",
            "required": true,
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
            "x-ms-docs-key-type": "AlertRuleSubscription"
          },
          {
            "in": "header",
            "name": "If-Match",
            "description": "ETag",
            "type": "string"
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "$ref": "#/responses/error"
          }
        },
        "x-ms-docs-operation-type": "operation"
      }
}
}

我的发布操作确实会回复一个Location标头,该标头与上述删除操作的格式相匹配.
我的问题是:

And my post operation does reply with a Location header which matches the format of the delete operation described above.
My questions are:

  • 触发器声明中缺少什么?
  • 如何获取有关订阅创建和Microsoft Flow生成的错误的更多详细信息?

推荐答案

与Microsoft进行了一些内部讨论之后,我们发现了两个主要问题.
首先,我更新了POST请求的body参数以创建对此的订阅.

After some internal discussions with Microsoft we found two main issues.
First I updated the body parameter of the POST request to create the subscription to this.


       {
        "name": "body",
        "in": "body",
        "required": false,
        "schema": {
         "type": "object",
         "properties": {
          "callbackUrl": {
           "type": "string",
           "required": true,
           "description": "callbackUrl",
           "x-ms-notification-url": true,
           "x-ms-visibility": "internal"
          }
         }
        }
       }

这是因为连接器定义不支持在不使用JSON格式的情况下在主体中发送回调URL,并且因为Flow已实现使用Open API回调规范.

That is because the connector definitions don't support sending the callback URL in the body without using JSON formatting and because Flow was implemented using the Open API callback specification.

第二,我更新了我的API以支持上述规范.

Second I updated my API to support the specification mentioned above.

这篇关于Microsoft Flow自定义连接器webhook触发器定义和实现:创建流后找不到404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆