/rest/api/2/version example in JIRA REST API doc does not work as expected

XMLWordPrintable

    • 6.04
    • 2
    • Severity 3 - Minor
    • 0

      Summary

      Using the example listed in /rest/api/2/version for the JIRA REST API documentation does not work.

      Example
      {
          "description": "An excellent version",
          "name": "New Version 1",
          "archived": false,
          "released": true,
          "releaseDate": "2010-07-06",
          "userReleaseDate": "6/Jul/2010",
          "project": "PXA"
      }
      

      Steps to Reproduce

      1. Create a project named PXA
      2. Run the following command
        curl -D- -u user:pw -X POST --data @myfile.txt -H "Content-Type: application/json" http://<instance-url>/rest/api/2/version/
        
        {
            "description": "An excellent version",
            "name": "New Version 1",
            "archived": false,
            "released": true,
            "releaseDate": "2010-07-06",
            "userReleaseDate": "6/Jul/2010",
            "project": "PXA"
        }
        

      Expected Results

      Version is created

      Actual Results

      Error

      {"errorMessages":["Only one of 'releaseDate' and 'userReleaseDate' can be specified when creating a version."],"errors":{}}
      

      Notes

      • Additionally, if you remove the userReleaseDate parameter, the version will be created.
      • However, anytime a value is set to true for archived or released, it always gets set to false. This need to be clarified as well whether it is possible to set the value as it is being mentioned in the example.

      See:

      {"self":" <instance-url>/rest/api/2/version/10010","id":"10010","description":"An excellent version","name":"New Version 1","archived":false,"released":false,"releaseDate":"2010-07-06","overdue":true,"userReleaseDate":"06/Jul/10","projectId":10100}
      

      Workaround

      If you are trying to set to the archived or released field to true, you must use

      PUT /rest/api/2/version/{id}
      

            Assignee:
            Mel Paisley
            Reporter:
            Javier Aguilar (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: