adazzle/PowershellScripts — pull request #5 by aqilzeeshan (2013-11-12 13:42:02+00:00)
Title: Issue with powershell version 3 Invoke-RestMethod

"Powershell version 3 had an inadequate implementation of Invoke-RestMethod, particularly the non-support for setting Accept HTTP Headers"

http://scn.sap.com/community/restful-sdk/blog/2013/09/05/scripting-web-intelligence-the-restful-raylight-web-services

so we are unable to set Accept HTTP Headers

'Accept: application/json',
'Content-Type: application/json'

for
Invoke-RestMethod -uri $uri -Headers $headers -ContentType "application/json" -Method Post -Body $body

hence getting errors

Powershell 4 supports it as shown here

"Invoke-RestMethod and Invoke-WebRequest now let you set all headers by using the Headers parameter. Although this parameter has always existed, it was one of several parameters for the web cmdlets that resulted in exceptions or errors."

http://technet.microsoft.com/en-us/library/hh857339.aspx

Powershell 4 is not yet available on http://chocolatey.org/ hence difficult to install.

Better option seems to be using cURL to make Rest calls to Jira. cURL is available on http://chocolatey.org/packages/curl and easy to install. It will become pre-requisite like chocolatey for people who use this git helper.Once cURL is installed it can be used from powershell script to make Rest calls to Jira as shown below

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Add+Comment

@bakesteve please let me know your thoughts on it.