Reputation: 21
I am trying to use the wrapper for Azure's REST API for Logic Apps Management which is shipped in Microsoft.Azure.Management.Logic namespace. Particularly, I am trying to use the IWorkflowOperations.CreateOrUpdate method.
The CreateOrUpdate() method takes in a IWorkflow object. The Workflow class itself has a Definition property which is of type object as explained here https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.logic.models.workflow.definition?view=azure-dotnet#Microsoft_Azure_Management_Logic_Models_Workflow_Definition I am having a hard time understanding what the definition object should be.
I am getting a serialization error when i try to execute the CreateOrUpdate part.
Thank you much in advance!
var wfLocation = "East US";
var wfDefinition = System.IO.File.ReadAllText(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wfDefinition.json"));
var wkflow = new Microsoft.Azure.Management.Logic.Models.Workflow() { Definition = wfDefinition, Location = wfLocation };
logicManagementClient.Workflows.CreateOrUpdate("xxxxxx", "new-test", wkflow);
// And wdDefinition.json looks like
{
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"HTTP": {
"inputs": {
"body": "Test Body",
"method": "POST",
"uri": "http://ptsv2.com/t/5351a-1565875020/post"
},
"runAfter": {},
"type": "Http"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"Sliding_Window": {
"recurrence": {
"frequency": "Second",
"interval": 3
},
"type": "SlidingWindow"
}
}
}
},
"location": "East US"
}
Upvotes: 1
Views: 195
Reputation: 21
Ok, I figured out what the definition looks like. I pulled an existing workflow and serialized it as JSON. This is what it looks like
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Minute",
"interval": 1
},
"type": "Recurrence"
}
},
"actions": {
"HTTP": {
"runAfter": {},
"type": "Http",
"inputs": {
"body": "Test Body",
"method": "POST",
"uri": "http://ptsv2.com/t/5351a-1565875020/post"
}
}
},
"outputs": {}
}
Upvotes: 1