Bamboo REST API does not allow empty values while editing capability

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 12.0.0
    • Component/s: REST API
    • None
    • Severity 3 - Minor

      Issue Summary

      A capability can have empty values  while editing via manually in the UI or via bamboo-capabilities.properties.

      The API Update existing agent capability  returns a 400 error when empty values set for capability. 

      --data '{"key": "test", "value": ""}'  

       

      Steps to Reproduce

      Use the REST API to add a capability value .

       $curl -u admin:$pass -X PUT --header 'Content-Type: application/json' <BambooUrl>/rest/api/latest/agent/688129/capability/test --data '{"key": "test", "value": ""}' 

      Expected Results

      The API should accept empty string values, consistent with:
      1. The Bamboo UI, which allows creating/editing capabilities with empty values
      2. The bamboo-capabilities.properties file, which accepts test= (empty value)
      3. The GET endpoint, which returns capabilities with empty values in the response 

       

      Actual Results

       % curl -X PUT <BAMBOO_URL>/bamboo/rest/api/latest/agent/688129/capability/test  -uadmin  --data '{
        "key": "test",
        "value": ""
      }'  --header 'Content-Type: application/json'
      Enter host password for user 'admin':
      {"errors":[],"fieldErrors":{"capabilityValue":["Need to add a value for the value field"]}}%       

      Workaround

      Currently there is no known workaround for this behavior via REST API. You can add them via Agent Capabilities screen or use the bamboo-capabilities.properties file.

            Assignee:
            Unassigned
            Reporter:
            Vani
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: