Mastering Azure Scheduler 2

Now you got your Scheduler service at previous article on Mastering Azure Scheduler 1, let’s dive into API and do something nice.

The API documentation is here,
https://msdn.microsoft.com/library/mt629143.aspx

I actually typically prefer to use SDK to keep things simple and easy but SDK I found for Azure Scheduler seems.. not the best yet? If anyone are using SDK version and happy, do let me know please.

Well, things aren’t always perfect and not waiting to be.  I ll use API.

Here are some of things I can do with API.

  • Create JobCollection
  • Update JobCollection
  • Delete JobCollection
  • Enable JobCollection
  • Disable JobCollection
  • Get JobCollection
  • Get JobCollections in ResourceGroup
  • Get JobCollections in Subscription
  • Create Job
  • Update Job
  • Delete Job
  • Run Job
  • Get Job
  • Get Jobs in a JobCollection
  • Get Job History

Since we already created first JobCollection and Job from the portal.  Let’s get list of all Jobs in a JobCollection first.

You can refer to http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client and http://www.asp.net/web-api/overview/advanced/sending-html-form-data-part-1 for how to send API request.

Just so I know I can get proper response, I am creating GET request to

using Postman. Oh but wait, I need to generate header with x-ms-request-id value which is a pain in butt.. as it should be for security reasons.  I have to use Azure Active Directory to obtain credential for this API first.

To call API, I ll be using Microsoft.AspNet.WebApi.Client.  The project URL is here http://www.asp.net/web-api.

I am going to create Controller call it SchedulerControllers.cs, Models call it SchedulerDocs.cs and views to manage all of this first.

The API documentation is here https://msdn.microsoft.com/en-us/library/mt629152.aspx

Model

I am creating requesting model, and not worry about response model for now.  I will just purse the response JSON data late.

At controller, I want default page to load list of jobs so making Index Action to handle this.

 

Leave a Reply