Azure Functions

I created my first Azure Function today.  It was pretty simple to create.  The short-cut URL to get to these is functions.azure.com.

I just clicked the new function button and I chose HttpTrigger in C#.  Azure created a sample app to work with.

I decided to create a function that calls Google Translate.  It accepts some text to translate, language in and a language out.

Azure generates and displays the URL to the function for you.

I modified the generated code to accept json parameters.  I added some code I found to call the Google API.  I had to add a using statement for Newtonsoft.Json.  I also had to add the statement ‘#r “Newtonsoft.Json”’ at the top.  I assume that creates some kind of reference to the Newtonsoft library.

To call the function I used a restful API extension tool in chrome.  I added the header values for Accept and Content-Type and added the body and that was all that is needed to call the API.

I look forward to finding uses for the cool feature.

Here is a screen shot of the Azure Function code screen

pic1

Here is a screen shot of my rest client

pic2

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s