Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12635

Reset repository description to a null value using REST API call

    XMLWordPrintable

Details

    Description

      Issue Summary

      Unable to reset the value of a repository description afterwards to an empty string using the REST API.

      Steps to Reproduce

      Step 1: Use the REST API query to set a description for a repository to something like 'test':

      curl -u admin:admin -v -X PUT -d '{ "description": "test" }' -H "Content-Type: application/json" http://localhost:7990/rest/api/1.0/projects/FIR/repos/new-repo
      

      Response:

      {"slug":"new-repo","id":13,"name":"new-repo","description":"test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":false,"project":{"key":"FIR","id":1,"name":"first","public":false,"type":"NORMAL","links":{"self":[{"href":"http://localhost:7990/projects/FIR"}]}},"public":true,"links":{"clone":[{"href":"http://localhost:7990/scm/fir/new-repo.git","name":"http"},{"href":"ssh://git@localhost:7999/fir/new-repo.git","name":"ssh"}],"self":[{"href":"http://localhost:7990/projects/FIR/repos/new-repo/browse"}]}}*
      

      Step 2: Now try to change this to a null value using the following:

      curl -u admin:admin -v -X PUT -d '{ "description": "" }' -H "Content-Type: application/json" http://localhost:7990/rest/api/1.0/projects/FIR/repos/new-repo
      

      Response:

      {"slug":"new-repo","id":13,"name":"new-repo","description":"test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":false,"project":{"key":"FIR","id":1,"name":"first","public":false,"type":"NORMAL","links":{"self":[{"href":"http://localhost:7990/projects/FIR"}]}},"public":true,"links":{"clone":[{"href":"http://localhost:7990/scm/fir/new-repo.git","name":"http"},{"href":"ssh://git@localhost:7999/fir/new-repo.git","name":"ssh"}],"self":[{"href":"http://localhost:7990/projects/FIR/repos/new-repo/browse"}]}}*
      

      Expected Results

      It should change it to a null value, that is, the description of the repository should be reset to empty.

      Actual Results

      curl -u admin:admin -v -X PUT -d '{ "description": "" }' -H "Content-Type: application/json" http://localhost:7990/rest/api/1.0/projects/FIR/repos/new-repo
      

      Response:

      {"slug":"new-repo","id":13,"name":"new-repo","description":"test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":false,"project":{"key":"FIR","id":1,"name":"first","public":false,"type":"NORMAL","links":{"self":[{"href":"http://localhost:7990/projects/FIR"}]}},"public":true,"links":{"clone":[{"href":"http://localhost:7990/scm/fir/new-repo.git","name":"http"},{"href":"ssh://git@localhost:7999/fir/new-repo.git","name":"ssh"}],"self":[{"href":"http://localhost:7990/projects/FIR/repos/new-repo/browse"}]}}*
      

      the description is still “test”, which means that when you pass an empty value it is ignored. This happens for ” ” null and well anything that is not actual text.

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available. Can use the Bitbucket UI instead to change the description.

      Attachments

        Activity

          People

            ckochovski@atlassian.com Christopher Kochovski
            04f11a9d4cc8 Apoorva
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Backbone Issue Sync