Reputation: 16823
How can a logic app HTTP trigger support both GET and POST methods?
A new logic app has a POST url, and you can add a parameter for "Method" and set it to GET
But how can you have the HTTP trigger work for both GET and POST requests ?
Upvotes: 1
Views: 1667
Reputation: 1119
Yes, it is possible to have the same Logic App respond to both the Get and the post request sent. The trick behind this is to have multiple HTTP triggers(One HTTP trigger only supports one verb at a time) defined for the logic App. See following logic app definition which has two different HTTP triggers one support GET and other the 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": {}
}
But note that once you introduce multiple triggers, you will loose the ability to use the designer view. All you need to do after this is go to the overview tab and obtain the call back urls from the trigger history.
Upvotes: 3