1

How should I handle the following PATCH request, for a user that when initially added didn't have any address (not even an empty addresses array)?

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "Add",
            "path": "addresses[type eq \"work\"].formatted",
            "value": "Columbus"
        }
    ]
}

Should I "proactively" create an addresses array, with a single value as following (what seems a very bad solutions)?

{"type": "work", formatted: "Columbus"}

I would expect a patch request that looks like:

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
     "Operations":[{
       "op":"add",
       "value":{
         "addresses":[
           {
             "formatted":"Columbus",
             "type":"work"
           }
         ]
     }]
}
Patman
  • 115
  • 1
  • 11

1 Answers1

1

If no array exists yet, then you should create the array and then add the value to the array. You can set it ahead of time to be an empty array, or can leave the value as null until such a point where a value needs to be added to the array, and then at that time create the array and then add the value to it. Kindly check this link