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?
Hi Nconforti,
I just noticed one issue with the data you are providing in the api request body
any roles that you want to add or remove, can you please put them in a list even if it is just one role or more than one? If you still see the problem, I will do further investigation.
I.E{"data":{"type":"user","roles_to_add":["t:Customer"]}}