Uploaded image for project: 'Identity'
  1. Identity
  2. ID-8004

Using REST API to add a user to a group to which it already belongs, error code is misleading

      Issue Summary

      I am using the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\). When the specified user is already a member of the specified group, the REST API call fails, as expected. However, the returned HTTP error is 400, and the HTTP response contains one error message that is not documented.

      So there are two problems here:
      1. The group name is not present in the error message
      2. The documentation for the 400 error says that it happens if:

      • group name is not provided.
      • accountId is missing.

      Steps to Reproduce

      1. Step 1 Use the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\).
      2. Step 2 When the specified user is already a member of the specified group, the REST API call fails, as expected.

      Expected Results

      • The error message should be the group name instead of the group ID on which the user already exists.
      • The error that happened to me is not documented which should have been documented.

      Actual Results

      • The error message is not documented.

        However, the returned HTTP error is 400, and the HTTP response contains one error message:
        "Cannot add user. User is already a member of '{1}'".

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

            [ID-8004] Using REST API to add a user to a group to which it already belongs, error code is misleading

            Kat N made changes -
            Resolution New: Timed out [ 10 ]
            Status Original: Gathering Impact [ 12072 ] New: Closed [ 6 ]
            SET Analytics Bot made changes -
            Support reference count Original: 2 New: 3
            SET Analytics Bot made changes -
            Support reference count Original: 1 New: 2
            SET Analytics Bot made changes -
            Support reference count New: 1
            Dishon Victor made changes -
            Component/s Original: JIRA [ 13891 ]
            Component/s New: Directory - Groups - Add / remove users [ 66395 ]
            Key Original: FEEDBACK-778182 New: ID-8004
            Symptom Severity New: Severity 3 - Minor [ 14432 ]
            Workflow Original: classic default workflow for Feedback Project [ 4288402 ] New: JAC Bug Workflow v3 [ 4288666 ]
            Project Original: Feedback [ 12310 ] New: Identity [ 16810 ]
            Status Original: Open [ 1 ] New: Gathering Impact [ 12072 ]
            Dishon Victor made changes -
            Description Original: h3. Issue Summary

            I am using the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\). When the specified user is already a member of the specified group, the REST API call fails, as expected. However, the returned HTTP error is 400, and the HTTP response contains one error message:
            "Cannot add user. User is already a member of '{1}'".

            So there are two problems here:
            1. The group name is not present in the error message
            2. The documentation for the 400 error says that it happens if:
            - group name is not provided.
            - accountId is missing.

            h3. Steps to Reproduce

             # Step 1 Use the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\).
             # Step 2 When the specified user is already a member of the specified group, the REST API call fails, as expected.

            h3. Expected Results

            * The error message should be the group name instead of the group ID on which the user already exists.
            * The error that happened to me is not documented which should have been documented.

            h3. Actual Results

            * Error message which is not documented.
            {quote}However, the returned HTTP error is 400, and the HTTP response contains one error *message:*
            "Cannot add user. User is already a member of '{1}'".(quote}

            The below exception is thrown in the xxxxxxx.log file:
            {noformat}
            ...
            {noformat}

            h3. Workaround

            Currently, there is no known workaround for this behavior. A workaround will be added here when available
            New: h3. Issue Summary

            I am using the REST API call to add a user to a group (here: [https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\|https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post]). When the specified user is already a member of the specified group, the REST API call fails, as expected. However, the returned HTTP error is 400, and the HTTP response contains one error message that is not documented.

            So there are two problems here:
            1. The group name is not present in the error message
            2. The documentation for the 400 error says that it happens if:
             - group name is not provided.
             - accountId is missing.

            h3. Steps to Reproduce
             # Step 1 Use the REST API call to add a user to a group (here: [https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\|https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post]).
             # Step 2 When the specified user is already a member of the specified group, the REST API call fails, as expected.

            h3. Expected Results
             * The error message should be the group name instead of the group ID on which the user already exists.
             * The error that happened to me is not documented which should have been documented.

            h3. Actual Results
             * The error message is not documented.
            {quote}However, the returned HTTP error is 400, and the HTTP response contains one error *message:*
            "Cannot add user. User is already a member of '\{1}'".{quote}

            h3. Workaround

            Currently, there is no known workaround for this behavior. A workaround will be added here when available
            Dishon Victor made changes -
            Description Original: h3. Issue Summary

            I am using the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\).
            When the specified user is already a member of the specified group, the REST API call fails, as expected.
            However, the returned HTTP error is 400, and the HTTP response contains one error message:
            "Cannot add user. User is already a member of '{1}'".

            So there are two problems here:
            1. The group name is not present in the error message
            2. The documentation for the 400 error says that it happens if:
            - group name is not provided.
            - accountId is missing.


            This is reproducible on Data Center: (yes) / (no)
            h3. Steps to Reproduce
             # Step 1 Use the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\).
             # Step 2 When the specified user is already a member of the specified group, the REST API call fails, as expected.

            h3. Expected Results
            * The error message should be the group name instead of the group ID on which the user already exists.
            * The error that happened to me is not documented which should have been documented.

            h3. Actual Results
            * Error message which is not documented.
            {quote}However, the returned HTTP error is 400, and the HTTP response contains one error *message:*
            "Cannot add user. User is already a member of '{1}'".(quote}

            The below exception is thrown in the xxxxxxx.log file:
            {noformat}
            ...
            {noformat}

            h3. Workaround

            Currently, there is no known workaround for this behavior. A workaround will be added here when available
            New: h3. Issue Summary

            I am using the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\). When the specified user is already a member of the specified group, the REST API call fails, as expected. However, the returned HTTP error is 400, and the HTTP response contains one error message:
            "Cannot add user. User is already a member of '{1}'".

            So there are two problems here:
            1. The group name is not present in the error message
            2. The documentation for the 400 error says that it happens if:
            - group name is not provided.
            - accountId is missing.

            h3. Steps to Reproduce

             # Step 1 Use the REST API call to add a user to a group (here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post\).
             # Step 2 When the specified user is already a member of the specified group, the REST API call fails, as expected.

            h3. Expected Results

            * The error message should be the group name instead of the group ID on which the user already exists.
            * The error that happened to me is not documented which should have been documented.

            h3. Actual Results

            * Error message which is not documented.
            {quote}However, the returned HTTP error is 400, and the HTTP response contains one error *message:*
            "Cannot add user. User is already a member of '{1}'".(quote}

            The below exception is thrown in the xxxxxxx.log file:
            {noformat}
            ...
            {noformat}

            h3. Workaround

            Currently, there is no known workaround for this behavior. A workaround will be added here when available
            Dishon Victor created issue -

              Unassigned Unassigned
              6ddbd1c1e1be Dishon Victor
              Affected customers:
              5 This affects my team
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: