Bamboo REST API /plan/{projectKey}-{buildKey}/variables POST fails with json content type

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Low
    • 9.0.0
    • Affects Version/s: 8.1.8, 8.2.4, 8.0.9
    • Component/s: REST API
    • None
    • Severity 3 - Minor

      Issue Summary

      This is reproducible on Data Center:

      When modifying Plan variables via the REST API https://docs.atlassian.com/atlassian-bamboo/REST/8.2.4/#d2e5901, Bamboo fails to create new variables when using a JSON content type reporting an HTTP 400 - "You must enter a valid variable name" error

      Steps to Reproduce

      GET
      $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
      []
      
      POST
      $ curl -H "Content-Type: application/json" -u admin:admin -X POST "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables" -d '{ "name":"foo", "value":"var" }'
      You must enter a valid variable name
      

      Expected Results

      The variables should be added to the Plan

      Actual Results

      The request fails with "You must enter a valid variable name"

      Workaround

      Use the following format:

      • /plan/{projectKey}-{buildKey}/variables?name=foo&value=bar
        POST
        $ curl -H "Content-Type: application/x-www-form-urlencoded" -u admin:admin -X POST "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables?name=foo&value=var"
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?><variable name="foo" value="var"/>
        GET
        $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
        [{"name":"foo","value":"var"}]
        

            Assignee:
            Mateusz Szmal
            Reporter:
            Eduardo Alvarenga (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: