How to use "Pull Request Query"?

Peter Boomsma

I want to return a pull request based on a commit. I found this > https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20query/get?view=azure-devops-rest-5.1

This API is used to find what pull requests are related to a given commit.

I'm using the following code:

$body = @"
{
    "items": [
        {
            "59c1c31397b266116ff6d735e5638ef5d1b598a0"
        }
    ]
}
"@ 

$someLink = "https://dev.something.com/embrace/somethingSomething/_apis/git/repositories/****-bf64-47d9-8b10-53f21220d54d/pullrequestquery?api-version=5.1"
Invoke-RestMethod -Uri $someLink -Headers @{Authorization = $pat } -Body $body -Method Post -ContentType 'application/json'

When I run the release I get a:

The remote server returned an error: (400) Bad Request.

Thiago Custodio

Try using the following body:

$body = @"
{
    "queries": [{
        "items": [
            "59c1c31397b266116ff6d735e5638ef5d1b598a0"
        ],
        "type": "commit"
    }]
}
"@ 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related