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

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

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

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

            Jan Majkutewicz (Inactive) made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Mateusz Szmal made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Mateusz Szmal made changes -
            Status Original: Long Term Backlog [ 12073 ] New: In Progress [ 3 ]
            Mateusz Szmal made changes -
            Fix Version/s New: 9.0.0 [ 100790 ]
            Mateusz Szmal made changes -
            Assignee New: Mateusz Szmal [ 851f15845f55 ]
            Mateusz Szmal made changes -
            Remote Link New: This issue links to "+core+ Dogfooding › Test Git Branch Detection › issue-BAM-21787-variables-rest-api (tardigrade-bamboo)" [ 665469 ]
            Patricio made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 659947 ]
            Mateusz Szmal made changes -
            Status Original: Needs Triage [ 10030 ] New: Long Term Backlog [ 12073 ]
            Eduardo Alvarenga (Inactive) made changes -
            Description Original: h3. 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
            h3. Steps to Reproduce
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            []
            {noformat}
            {noformat:title=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":"bar" }'
            You must enter a valid variable name
            {noformat}
            h3. Expected Results

            The variables should be added to the Plan
            h3. Actual Results

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

            Use the following format:
             * {{/plan/\{projectKey}-\{buildKey}/variables?name=foo&value=bar}}
            {noformat:title=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"/>{noformat}
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            [{"name":"foo","value":"var"}]
            {noformat}
            New: h3. 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
            h3. Steps to Reproduce
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            []
            {noformat}
            {noformat:title=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
            {noformat}
            h3. Expected Results

            The variables should be added to the Plan
            h3. Actual Results

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

            Use the following format:
             * {{/plan/\{projectKey}-\{buildKey}/variables?name=foo&value=bar}}
            {noformat:title=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"/>{noformat}
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            [{"name":"foo","value":"var"}]
            {noformat}
            Eduardo Alvarenga (Inactive) made changes -
            Description Original: h3. 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
            h3. Steps to Reproduce
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            []
            {noformat}
            {noformat:title=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":"bar" }'
            You must enter a valid variable name
            {noformat}
            h3. Expected Results

            The variables should be added to the Plan
            h3. Actual Results

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

            Use the following format:
             * {{/plan/\{projectKey}-\{buildKey}/variables?name=foo&value=bar}}

            {noformat:title=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"/>{noformat}

            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            [{"name":"foo","value":"var"}]
            {noformat}
            New: h3. 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
            h3. Steps to Reproduce
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            []
            {noformat}
            {noformat:title=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":"bar" }'
            You must enter a valid variable name
            {noformat}
            h3. Expected Results

            The variables should be added to the Plan
            h3. Actual Results

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

            Use the following format:
             * {{/plan/\{projectKey}-\{buildKey}/variables?name=foo&value=bar}}
            {noformat:title=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"/>{noformat}
            {noformat:title=GET}
            $ curl -u admin:admin -X GET "https://bamboo.mydomain.net/rest/api/latest/plan/ABC-DFG/variables"
            [{"name":"foo","value":"var"}]
            {noformat}

              851f15845f55 Mateusz Szmal
              73868399605e Eduardo Alvarenga (Inactive)
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: