PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 24, 2022

[FIXED] How to pass complex object from JSON (REST call) to Yaml azure devops

 July 24, 2022     azure-devops, azure-devops-rest-api, azure-pipelines-yaml, json, yaml     No comments   

Issue

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?


Solution

Please try using the following Request body:

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


Answered By - Andy Li-MSFT
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing