# PATCH a criteria based role

**URL:** <https://developer.sailpoint.com/discuss/t/patch-a-criteria-based-role/6775>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security, apis\
**Created:** [November 16, 2022, 11:47pm UTC](https://developer.sailpoint.com/discuss/t/patch-a-criteria-based-role/6775 "2022-11-16T23:47:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simpyparveen](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@simpyparveen](https://developer.sailpoint.com/discuss/u/simpyparveen)\
**Post date:** [November 16, 2022, 11:47pm UTC](https://developer.sailpoint.com/discuss/t/patch-a-criteria-based-role/6775/1 "2022-11-16T23:47:37Z")

</div>

Hello,

I am attempting to add memebership criteria to a role (membership determined by Accoun attribute) by using the beta api endpoint - https://{$$.env.org}.api.identitynow.com/beta/roles/{id}.  
When forming the request body, what should the “path” (json pointer) be set to?  
Also, what should the “value” value be set to?  
I am currently setting it as a string which is membership object (obtained from GET of same role), since I want to add lis of criterias in membership.  
But receiving the error message in body with response code 404:

```json
{
    "error": "No message available"
}

```

```json
[
    {
        "op": "add",
        "path": "/membership",
        "value": {
            "type": "STANDARD",
            "criteria": {
                "operation": "OR",
                "key": null,
                "stringValue": "",
                "children": [
                    {
                        "operation": "AND",
                        "children": [
                            {
                                "operation": "CONTAINS",
                                "key": {
                                    "type": "ACCOUNT",
                                    "property": "attribute.MY_ID",
                                    "sourceId": "2cxxxxx2yyy222222222222"
                                },
                                "stringValue": "MY123"
                            }
                        ]
                    }
                ]
            },
            "identities": null
        }
    }
]

```

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [November 21, 2022, 3:21pm UTC](https://developer.sailpoint.com/discuss/t/patch-a-criteria-based-role/6775/2 "2022-11-21T15:21:16Z")

</div>

the `add` operation is for adding elements to a list. The `membership` property of a role is an object, not a list. Try using `replace` as your operation instead.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:23pm UTC](https://developer.sailpoint.com/discuss/t/patch-a-criteria-based-role/6775/3 "2023-07-19T14:23:51Z")

</div>

Closed on July 19, 2023, 2:23pm UTC


