alexdemers

Bulk add/remove roles using the REST API

0 votes
I'm trying to update all the roles such as adding and removing a few of them with one API call. I tried:
PUT /api/packages/{packageId}/roles
... but I get "500 Internal Server Error". I also tried to simply update the package with only the roles attribute filled when making the API call to
PUT /api/packages/{packageId}
... I don't get any errors but the roles have not been updated. My guess is that I need to have an API call for each add/remove that I need to do. Is that my only option? Thanks.

Reply to: Bulk add/remove roles using the REST API

1 votes
Hi alexdemers, Thanks for making the post! The short answer for the question is, yes, you have to add/update/remove roles individually. I think you were referring to our OpenAPI Specification site for the PUT /api/packages/{packageId}/roles call. After I checked our backend source code, I found out that this API can only be used for reordering signer and will only take the existing role ID and index number, any payload other than that may cause an internal exception thrown, and therefore you saw the 500 error (uncatalogued exception).
[
  {
    "id": "4a987ef9-ef38-4bcd-9eab-a1a812af099f",
    "index": 1
  },
  {
    "id": "93734eed-c237-4a22-8e8f-d21535dc48d2",
    "index": 2
  }
]
This is from my best understanding of this API. I also found the API description a little bit confusing, so if you want, I can create a support ticket asking for clarification. For PUT /api/packages/{packageId}API, it will only process package level fields. Not updating "roles" node should be expected. Hope this could help! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off