Add and Remove operations not working as expected for PATCH /v3/auth-users

We have a PATCH guide for our APIs. Add and remove are tricky, so I highly encourage you to read the guide for both operations very carefully.

add operation guide

remove operation guide

The TLDR is that to add an item to an array, you must provide the array index in the path. For example, the below payload will add the HELPDESK capability at the beginning of the capabilities array.

[
  {
    "op": "add",
    "path": "/capabilities/0",
    "value": "HELPDESK"
  }
]

Remove works similarly. You must provide the index of the item you want to remove.

[
  {
    "op": "remove",
    "path": "/capabilities/0"
  }
]

If you don’t provide the index in the path, then add will operate like a replace operation, and remove will just remove everything.

You can also see this post for more information about adding and removing capabilities using the auth users API.

1 Like