Can I use powershell to "call" an url on jira to create a version for a project?
Community moderators have prevented the ability to post new answers.
here is a powershell cmd to do that
[CmdletBinding()] Param( [Parameter(Mandatory=$True, Position=1)] [string]$project, [Parameter(Mandatory=$True, Position=2)] [string]$newVersionName, [Parameter(Mandatory=$True, Position=3)] [string]$newVersionDesc ) function ConvertTo-Base64($string) { $bytes = [System.Text.Encoding]::UTF8.GetBytes($string); $encoded = [System.Convert]::ToBase64String($bytes); return $encoded; } function Get-HttpBasicHeader([string]$username, [string]$password, $Headers = @{}) { $b64 = ConvertTo-Base64 "$($username):$($Password)" $Headers["Authorization"] = "Basic $b64" return $Headers } $restapiuri = "http://yourserver/rest/api/2/" $headers = Get-HttpBasicHeader "yourusername" "yourpass" function CreateVersion { $jsonReponse = Invoke-RestMethod -uri ($restapiuri +"project/"+$project+"/versions") -Headers $headers -Method Get -ContentType "application/json" #create new version $body = ('{"name": "' + $newVersionName +'", "description": "'+ $newVersionDesc+'", "project": "' + $project +'"}') Invoke-RestMethod -uri ($restapiuri +"version/") -Headers $headers -Method POST -ContentType "application/json" -Body $body }
You can use JIRA Command Line Interface, specifically addVersion action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.