There are a few related questions in stack I'll drop them below. I'm working with Azure DevOps api 5.1 and attempting to queue a build.
{
"Definition": {
"id": "7"
}
}
This will queue a build with the variables that are already set in the definition. I have attempted to pass in variables in a few different ways both of which wound up not being honored by the API at all.
{
"Definition": {
"id": "7",
"variables": {
"tag": "@{value=v1.1.0}",
"system.debug": "@{value=true}"
}
}
}
Per some of the related questions I also attempted
{
"Definition": {
"id": "7",
"parameters": {
"tag": "@{value=v1.1.0}",
"system.debug": "@{value=true}"
}
}
}
After capturing the output from chrome while queuing a build via the UI it appears to expect variables as opposed to parameters, but what i'm seeing when i go back to view the builds is that the variables being passed in are not being honored. Additionally I have taken the definition I wish to run and stashed it into the body.definition above.
VSTS use API to set build parameters at queue time
TFS 2017 API; Queuing a build with variables
How to QUEUE a new build using VSTS REST API
Please let me know if I should add more detail I've not put the actual code, but it is pretty straightforward
Invoke-RestMethod -Method post -Uri $uri -Headers $Header -ContentType 'application/json' -Body ($Body |ConvertTo-Json -Compress -Depth 10)