Vadim Tabakman

Creating a Nintex Workflow Cloud Xtension using a C# Azure Function

This is a little addendum to the previous post :

Since I've done a lot more C# dev than Javascript, I started looking into how to built an Azure Function using C#.

Below is one such function that does a Trigonometry Sin calculation.

The idea is to show how pass in information from a Query String or Body, use that to then do a Calculation and return the result that will eventually come out as JSON, with "result" being the key name.

using System.Net;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
    log.Info("C# HTTP trigger function processed a request.");

    // parse query parameter
    string angle = req.GetQueryNameValuePairs()
        .FirstOrDefault(q => string.Compare(q.Key, "angle", true) == 0)

    // Get request body
    dynamic data = await req.Content.ReadAsAsync<object>();

    // Set name to query string or body data
    angle = angle ?? data?.angle;

    return angle == null
        ? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a angle on the query string or in the request body")
        : req.CreateResponse(HttpStatusCode.OK, "{ \"result\": \"" + Math.Sin(Convert.ToDouble(angle)) + "\"}");

Posted by Vadim Tabakman Thursday, August 3, 2017 1:58:00 PM Categories: Azure Function Nintex Nintex Workflow Nintex Workflow Cloud
Copyright Vadim Tabakman
Rate this Content 0 Votes


You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?



  • Entries (255)
  • Comments (1752)