Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21787

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 9.0.0
    • 8.1.8, 8.2.4, 8.0.9
    • REST API
    • None

    Description

      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"}]
        

      Attachments

        Issue Links

          Activity

            People

              851f15845f55 Mateusz Szmal
              73868399605e Eduardo Alvarenga
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: