Reputation: 467
I'm using the visualstudio.com to manage our code. Is there any way to get a list of Pull request include title, creator, PRid, created time, status...
Upvotes: 0
Views: 110
Reputation: 33738
Refer to this code to get Pull Requests through Pull Request REST API.
param(
[string]$token,
[string]$project,
[string]$repo
)
$uri="https://{your vsts accout}.visualstudio.com/$project/_apis/git/repositories/$repo/pullrequests?api-version=4.1"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "test",$token)))
$result= Invoke-RestMethod -Method GET -Uri $Uri -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
#Write-Output $result.createdBy
$partResult=$result.value | select-object -Property title,pullRequestId,status, @{Name="createdBy"; Expression={ $_.createdBy | Select-Object displayName }}
Write-Output $partResult
Upvotes: 1