Customer Self-Service Portal

Scheduling Maintenance "now" with API

I am working on a deployment plan to deploy updates to a website.  I want to be able to put my website monitor in maintenance using the API.  I have examined the API and I know I can use a variaty of methods to make the API call.  What I am trying to figure out is a way to do this:

Step 1: API Call that will put the targeted monitor in maintenance mode "starting now" and lasting for 5 minutes.

Step 2: CI - Script Deploy application changes which will restart the web application

Step 3: API Call that will cancel the maintenance mode if the website comes back up before the 5 minutes has passed.

 

The step 3 is not going to be critical.  More of a "nice to have".  

The challenge is to figure out how to tell the API the date and time.  Hoping someone can give me some insight into ways to accomplish this.