逻辑应用 HTTP 触发器如何同时支持 GET 和 POST 方法?
How can a logic app HTTP trigger support both GET and POST methods?
逻辑应用 HTTP 触发器如何支持 GET 和 POST 方法?
一个新的逻辑应用程序有一个 POST url,您可以为 "Method" 添加一个参数并将其设置为 GET
但是如何让 HTTP 触发器同时对 GET 和 POST 请求起作用?
是的,可以让同一个逻辑应用响应发送的 Get 和 post 请求。这背后的技巧是为逻辑 App 定义多个 HTTP 触发器(一个 HTTP 触发器一次只支持一个动词)。请参阅以下逻辑应用程序定义,它有两个不同的 HTTP 触发器,一个支持 GET,另一个支持 POST Verb.
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Response": {
"inputs": {
"body": {
"sample": "response"
},
"headers": {
"Content-Type": "application/json"
},
"statusCode": 200
},
"kind": "Http",
"runAfter": {},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manualGET": {
"inputs": {
"method": "GET",
"schema": {
"properties": {
"sample": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
},
"manualPOST": {
"inputs": {
"method": "POST",
"schema": {
"properties": {
"sample": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
但请注意,一旦引入多个触发器,您将失去使用设计器视图的能力。
之后您需要做的就是转到概览选项卡并从触发历史记录中获取回调 url。
逻辑应用 HTTP 触发器如何支持 GET 和 POST 方法?
一个新的逻辑应用程序有一个 POST url,您可以为 "Method" 添加一个参数并将其设置为 GET
但是如何让 HTTP 触发器同时对 GET 和 POST 请求起作用?
是的,可以让同一个逻辑应用响应发送的 Get 和 post 请求。这背后的技巧是为逻辑 App 定义多个 HTTP 触发器(一个 HTTP 触发器一次只支持一个动词)。请参阅以下逻辑应用程序定义,它有两个不同的 HTTP 触发器,一个支持 GET,另一个支持 POST Verb.
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Response": {
"inputs": {
"body": {
"sample": "response"
},
"headers": {
"Content-Type": "application/json"
},
"statusCode": 200
},
"kind": "Http",
"runAfter": {},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manualGET": {
"inputs": {
"method": "GET",
"schema": {
"properties": {
"sample": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
},
"manualPOST": {
"inputs": {
"method": "POST",
"schema": {
"properties": {
"sample": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
但请注意,一旦引入多个触发器,您将失去使用设计器视图的能力。 之后您需要做的就是转到概览选项卡并从触发历史记录中获取回调 url。