I am trying to create a work-item in VSTS using power shell that I will be using with some of my custom solutions
Can anyone help me with the script?
Refer to this script:
param(
[string]$witType,
[string]$witTitle
)
$u="https://[account].visualstudio.com/DefaultCollection/[team project]/_apis/wit/workitems/`$$($witType)?api-version=1.0"
$body="[
{
`"op`": `"add`",
`"path`": `"/fields/System.Title`",
`"value`": `"$($witTitle)`"
}
]"
$user = "test"
$token = "[personal access token]"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$result=Invoke-RestMethod -Method PATCH -Uri $u -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json-patch+json" -Body $body
Arguments: -witType "task" -witTitle "PowerShellWIT1"