ContributionsMost RecentMost LikesSolutionsRe: roles_to_add/roles_to_remove not working ShalinA SuzieH Yes - wrapping it with brackets works! {"data":{"type":"user","roles_to_add":["t:Customer"]}}' This was a successful request! If you could expand the documentation or add an example, that would be great for the future! Re: roles_to_add/roles_to_remove not working Hi ShalinA - I removed that role from the user. This is on our production instance and I'm authenticating with a session key using my admin credentials. I also tried using CURL with this command: curl -X PUT https://community.<company>.com/api/2.0/users/6 -H 'content-type: application/json' -H 'li-api-session-key:<session key>' -d '{"data":{"type":"user","roles_to_add":"t:Customer"}}' I also get a success response: {"status":"success","message":"","http_code":200,"data":{...} Using the same call with the V1 API worked as a workaround, but the v2 API still isn't working Re: roles_to_add/roles_to_remove not working Hi Tarun I also tried using the id, but it also didn't work. payload={"data":{"type":"user","roles_to_add": "t:Customer"}} roles_to_add/roles_to_remove not working Hi everyone, I'm developing a python script and using the Khoros python module. Through this module I'm sending a PUT request to the community to either add or remove roles from specific users. My request looks like: comm_url = 'https://community.<company>.com/api/2.0/users/6/' #+ user_id payload = {} payload={"data":{"type":"user","roles_to_add": "Customer"}} headers = {"Content-Type":"application/json"} res = khoros.api.put_request_with_retries(url=comm_url,json_payload=payload,khoros_object=community_name) At first I thought my python or something was wrong (still could be the case), but if I change "roles_to_add" to "biography", the biography gets updated correctly. But anytime I use roles_to_add or roles_to_remove, I get a 200 response back, but can't see any changes. The audit log also shows no changes. I'm on Revision: 20.3 (20.3-release r2005190939) Commit Id: be1c5d989e418530a2eadae02e4bc26cf353f913 Does anyone else have this trouble? Should I use another method to update the roles for a user via a PUT request? SolvedRe: Get role for every user I'll take a look! Thanks Adam! Re: Get role for every user Thanks for the confirmation. That's what I thought Get role for every user Hi everyone, I'm currently trying to create a list of users and each user's role. I can make a call using V2 API to get the list of users, but in the 'roles' field, I only get the query I can use to retrieve that person's role. Right now I make a call using the Khoros python project to get all of the users, and then have to iterate over each of the users to get the roles assigned to them, which isn't very efficient. Is it possible to make just one call to get a list of users AND the roles at one time instead of having to make hundreds of calls to get the roles? Maybe there's something I'm missing. Appreciate the help! SolvedRe: Check if user is a member of a group hub Ah now it's clear. Thanks for the help! Re: Check if user is a member of a group hub Hey Tarun , Thanks for the hint on the API browser!! I checked my version and I'm running 20.1 (Revision: 20.1 (20.1-release r2005011223)) Group Hubs is enabled because I'm able to create Group Hubs and have some of them set up already. Any other idea? Check if user is a member of a group hub Hi everyone, I'm currently trying to create a component which will check if a user is a member of a group hub and then if they are, display something on a page. I keep using the LiQL from https://developer.khoros.com/khoroscommunitydevdocs/docs/membership-liql-examples, but for almost each one, I get an "invalid query syntax" error. Does anyone what might be the cause? Here is the code I'm using: <#assign apiVersion = "2.0"/> <#assign liql_query = "SELECT join_date, title FROM nodes WHERE user.id = '" + user.id + "' "/> ${liql_query} <#assign users= rest(apiVersion, "/search?q=" + liql_query?url + "&restapi.response_style=view") /> <br>${users.status} <br>${users.message} I've also tried the following queries, but same error (invalid query syntax): SELECT id,login FROM users WHERE node.id = 'grouphub:EAP' SELECT login, id, join_date FROM users WHERE node.id = '<node.type>:<node.id>' <#assign liql_query = "SELECT * FROM roles WHERE users.id = '" + user.id + "' and node.id = 'grouphub:EAP'"/> I can't for the life of me figure out what is wrong with the queries. I would appreciate the help! Solved