Home > OS >  How to pass complex object from JSON (REST call) to Yaml azure devops
How to pass complex object from JSON (REST call) to Yaml azure devops

Time:07-15

I have an azure devops pipeline where I declare the following parameter:

parameters:
  - name: extra_tags
    displayName: Extra tags to add
    type: object
    default:
      foo: "bar"
      two: "three"

And it fails when I to trigger the pipeline via Http REST with the following body:

{
    "resources": {
        "repositories": {
            "self": {
                "refName": "refs/heads/main"
            }
        }
    },
    "templateParameters": {
        "extra_tags": {
            "1": "one",
            "2": "two"
        }
    }
}

If I remove the extra_tags, it works, since I declared the default, has anyone faced such problem?

CodePudding user response:

Please try using the following Request body:

{
    "resources": {
        "repositories": {
            "self": {
                "refName": "refs/heads/main"
            }
        }
    },
    "templateParameters": {
        "extra_tags": "1: one\n2: two"
    }
}
  • Related