Sending a PATCH request against a SCIM directory with a 'replace' Operation, that includes the emails field which is the same as the current state fails with HTTP 400

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      Sending a PATCH request against a SCIM directory with a 'replace' Operation, that includes the emails field which is the same as the current state fails with the following error:

      "status": "400",
      "detail": "Resource [USER] One email address need to be marked as primary."

      This is reproducible on Data Center: Not verified

      Steps to Reproduce

      API - https://developer.atlassian.com/cloud/admin/user-provisioning/rest/api-group-users/#api-scim-directory-directoryid-users-userid-patch

      With curl

      curl --request PATCH \
      --url 'https://api.atlassian.com/scim/directory/xxxxxxxxxxxxxxxxxx/Users/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
      --header 'Authorization: Bearer <token>' \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/json' \
      --data '{
      "schemas":[
      "urn:ietf:params:scim:api:messages:2.0:PatchOp"
      ],
      "Operations":[
      				{
      					"op": "replace",
      					"path": "active",
      					"value": "true"
      				},
      				{
      					"op": "replace",
      					"path": "emails",
      					"value": [
      								{
      									"value": "email@example.com",
      									"primary": true
      								}
      					]
      				}
      			]
      }'
      

      Send this to a user with is active:false and I get the following.

      {"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"status":"400","detail":"Resource [USER] One email address need to be marked as primary."}%  
      

      Expected Results

      Sucess 200

      Actual Results

      Failed 400

      {"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"status":"400","detail":"Resource [USER] One email address need to be marked as primary."}%  
      

      Workaround

      Use PUT command or not send the email attribute that has not changed.

            Assignee:
            Unassigned
            Reporter:
            Vindika D
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: