Legacy Dev Forum Posts

 View Only

Sign Up

Cant update or post roles to a user

  • 1.  Cant update or post roles to a user

    Posted 06-05-2025 19:19

    Steve_Portock | 2018-06-12 19:25:53 UTC | #1

    I am trying to use the api to post roles to a user, I can't figure out what the body of the post should have in it, whatever I have tried tells me the post is malformed. What is the correct way for this or any other post?


    Jason_Mathison | 2018-06-13 13:48:09 UTC | #2

    For the /api/v2/users/{userId}/roles API it appears that the body should be an array of role GUIDs. So something like this:

    ["fb066782-70e3-45e5-8a98-57861a79cb48", "otherRoleGUID", "anotherGUID", "etc"]

    Important note, posting to this route is going to overwrite the existing set of roles for the user, not just add new ones. Depending on your use case you may need to pull the list of roles first with a get to the same route, manipulate the list and then do a post.

    You will need the user ID, which is also a GUID. The best way that I know of to get a user's guid is via the /api/v2/users/search API.


    Steve_Portock | 2018-06-13 14:20:03 UTC | #3

    Thank you I did eventually figure that out. I also did take into consideration the other suggestions.


    system | 2018-07-14 14:20:04 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 2995