I am trying to automate the creation of Azure Pipelines for a particular branch using their REST api.
However, I am struggling to use almost all their API's, as their documentation lacks examples.
Things like List and Get are simple enough.
However, when it comes to queuing a build: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.0
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=6.0
{
    "parameters": <parameters>, // how do i send paramters
    "definition": {
        "id": 1
    },
    "sourceBranch": "refs/heads/feature/my-pipeline",
    "sourceVersion": "d265f01aeb4e677a25725f44f20ceb3ff1d7d767"
}
I am currently struggling to send parameters. I have tried:
Simple JSON like:
"parameters": {
    "appId": "bab",
    "platform": "android",
    "isDemo": true
}
and stringify version of JSON like:
"parameters": "{\"appId\": \"bab\",\"platform\": \"android\",\"isDemo\": true}"
but none seems to work.
It keeps giving me the error:
{
    "$id": "1",
    "customProperties": {
        "ValidationResults": [
            {
                "result": "error",
                "message": "A value for the 'appId' parameter must be provided."
            },
            {
                "result": "error",
                "message": "A value for the 'platform' parameter must be provided."
            },
            {
                "result": "error",
                "message": "A value for the 'isDemo' parameter must be provided."
            }
        ]
    },
    "innerException": null,
    "message": "Could not queue the build because there were validation errors or warnings.",
    "typeName": "Microsoft.TeamFoundation.Build.WebApi.BuildRequestValidationFailedException, Microsoft.TeamFoundation.Build2.WebApi",
    "typeKey": "BuildRequestValidationFailedException",
    "errorCode": 0,
    "eventId": 3000
}
The docs is very unclear in how to send this data: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1#propertiescollection
Thank you very much for you help.
 
     
     
    