Task Scheduler Calling Web APIs

Windows Task Scheduler can call Web APIs via powershell.  It requires Powershell 3.0.

powershell “Invoke-WebRequest http://xxxx.com/webservice/api/v1/Test/Version

C:>powershell "Invoke-WebRequest http://xxxx.com/webservice/api/v1/Test/Version"

StatusCode : 200
StatusDescription : OK
Content : {"Input":"Version()","StatusCode":200,"Message":nu
RawContent : HTTP/1.1 200 OK
Pragma: no-cache
Content-Length: 106
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 01 Mar 2013 23:44:24 GMT
Expires: -1
Server: Microsoft-IIS/...
Forms : {}
Headers : {[Pragma, no-cache], [Content-Length, 106],
[Cache-Control, no-cache], [Content-Type,
application/json; charset=utf-8]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 106
One can simply create and run a scheduled task and use fiddler to verify that the web api call takes place.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s