Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-68249

POST /rest/api/2/user returns misleading message upon specific condition

XMLWordPrintable

      Summary

      When programmatically creating a user by POSTing to /rest/api/2/user, if there already is an existing user associated with the same email address being passed as the request's data, but with a different username, the message returned is:

      {"errorMessages":["The user named '<username>' does not exist"]

      Steps to Reproduce

      1. Create a user with the following attributed:
        • emailAddress: foo@bar.com
        • displayName: Foobar
        • name: foobar
      2. Now attempt to create the following user via REST API:
        curl -D- -u <email_address> -H "Content-Type: application/json" -d '{"emailAddress": "foo@bar.com", "displayName": "Foobar", "name": "foo-bar-different"}' -X POST https://<instance>.atlassian.net/rest/api/2/user

      Expected Results

      An error message is returned saying that there already is a user associated with that email address.

      Actual Results

      The following error is returned:

      {"errorMessages":["The user named 'foo-bar-different' does not exist"],"errors":{}}

      Note

      It also happen if the user existed before in the instance. After deleting the user and recreating the user via rest api will return the same error in Splunk. However, from the rest api response as below and user still successfully created :-

      {
          "errorMessages": [
              "The request failed. We're not sure what went wrong. Try again and if the problem persists, contact Jira support."
          ],
          "errors": {}
      }
      

              Unassigned Unassigned
              epereira@atlassian.com bpevandro (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: