逻辑应用程序HTTP触发器如何同时支持GET和POST方法



逻辑应用程序HTTP触发器如何同时支持GET和POST方法?

一个新的逻辑应用程序有一个POST url,您可以为"Method"添加一个参数,并将其设置为GET

但是,如何让HTTP触发器同时用于GET和POST请求呢?

是的,可以让同一个逻辑应用程序同时响应发送的Get和post请求。这背后的诀窍是为逻辑应用程序定义多个HTTP触发器(一个HTTP触发器一次只支持一个动词(。请参阅下面的逻辑应用程序定义,它有两个不同的HTTP触发器,一个支持GET,另一个支持POST谓词。

{
"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。

最新更新