API to move the access profiles

Hi, I need to copy the access profiles from a role and add them to another role using API, got the below error

You’re trying to do a PATCH, but your content-type is application/json and your message body is not a valid body.

Content-type should be application/json-patch+json

The body for a PATCH operation should follow this pattern:

[
  {
    "op": "replace",
    "path": "/description",
    "value": "New description"
  }
]

So, perhaps try this:

[
  {
    "op": "add",
    "path": "/accessProfiles",
    "value": [
       list of ids here
    ]
  }
]

No luck, still getting the same error

Can you repost your updated message body and headers?

Hi @ssel , please try with the following payload:

[
    {
        "op": "add",
        "path": "/accessProfiles",
        "value": [
            {
                "id": "accesprofile_Id1"
            },
            {
                "id": "accesprofile_Id2"
            }
        ]
    }
]

Note: It replaces the access profiles that already exist in the role, so make sure to include the access profile Ids that are already part of the role in the payload.

Regards,

Prashanth

1 Like