Update Identity Roles

I need to update some Identity Role to add additional Access Profiles on top of the Access Profiles already assigned to the Identity Role.

When trying to use PATCH https://sailpoint.api.identitynow.com/v3/roles/:id
with body:

{
    "op": "add",
    "path": "/accessProfiles",
    "value": [
        {
            "id": "Access PRofile ID",
            "type": "ACCESS_PROFILE",
            "name": "Access PRofile Name"
        }
    ]
  }

It replaces all the existing Access Profiles and add only the new one.

Is this a bug and what’s the difference now between add and replace operations?

You need to use an index ‘N’ in the path, where N will be the total count of current access profiles

{
    "op": "add",
    "path": "/accessProfiles/N",
    "value": [
        {
            "id": "Access PRofile ID",
            "type": "ACCESS_PROFILE",
            "name": "Access PRofile Name"
        }
    ]
  }
1 Like

I tried adding an index N on one of the Identity Roles but received an error.

{
    "messages": [
        {
            "localeOrigin": "REQUEST",
            "locale": "en-US",
            "text": "The request was syntactically correct but its content is semantically invalid."
        },
        {
            "localeOrigin": "DEFAULT",
            "locale": "en-US",
            "text": "The request was syntactically correct but its content is semantically invalid."
        }
    ],
    "detailCode": "400.1 Bad request content",
    "trackingId": "2213016e41524c70bec9e1cd4da285db"
}

Body for this PATCH request needs to be an array, which will be

[
  {
      "op": "add",
      "path": "/accessProfiles/N",
      "value": [
          {
              "id": "Access PRofile ID",
              "type": "ACCESS_PROFILE",
              "name": "Access PRofile Name"
          }
    ]
  }
]

And Content-type in Header should be application/json-patch+json

However, I noticed that this is still returning error (even when I used the body directly from SP document page) though it has worked several times in the past for me

{
    "messages": [
        {
            "localeOrigin": "DEFAULT",
            "locale": "en-US",
            "text": "The request could not be parsed."
        },
        {
            "localeOrigin": "REQUEST",
            "locale": "en-US",
            "text": "The request could not be parsed."
        }
    ],
    "detailCode": "400.0 Bad request syntax",
    "trackingId": "2cbe449f8add46e0a7a2260763956fb6"
}

Not sure what am I missing and hoping someone in the community will be able to resolve this

Hi @iamology and @AhmedHisham7 ,

The body you have provided is returning same error. However, you can use the below body to execute the patch operation successfully but the only catch is you have to provide the existing ids of the access profiles present in the role so that the new access profile will not overwrite the existing profiles.
Body:
[
{
“op”: “add”,
“path”: “/accessProfiles”,
“value”: [
{
“id”: “new profile_id”,
“type”: “ACCESS_PROFILE”
},
{
“id”: “old profile_id1”,
“type”: “ACCESS_PROFILE”
},
.
.
.
{
“id”: “old profile_idN”,
“type”: “ACCESS_PROFILE”
}
]
}
]

2 Likes