Corporate Headquarters (972) 407-0688 1 (877) 492-9484
International Headquarters +44 (0)203 178 3010
What is the best method of programmatically adding users to specific roles within Telligent Community? I noticed that the REST API does not appear to support user role updates, only retrieval. Is the only option to call database stored procedures directly or are there better options?
For what it's worth, I am writing two small applications to manage user accounts within our system:
With each application, I will be creating/updating/deleting user accounts and need the ability to place users into school-based roles.
Robert MillerIssaquah School District
Whilst there are no endpoints for editing user roles through the v2 apis, there are endpoints in the v1 api - see telligent.com/.../membership.aspx for more details.
Robert, the v1 REST APIs are not deprecated yet. There is a lot of functionality still that exists in v1 that has not been built in the v2 API. If you have a choice of one vs the other for the same task then definitely choose v2, but you're still safe in using the v1 API.
Hi Robert,
We have done this using the RoleService() with the internal API. Something like:
CommunityServer.Components.RoleService roleService = Telligent.Common.Services.Get<CommunityServer.Components.RoleService>();
//need to get/create csUser object above here
roleService.AddUserToRole(csUser);
This worked really well for us, I'd imagine the recomended approach is to use the webservice though.
Thanks
Adam
Thanks, Alex! I take it the v1 REST APIs have not been deprecated in favor of the v2 REST APIs? I was concerned that the v1 APIs would be removed and did not give them much notice.
Thanks, Dan!
Adam, when you did the RoleService thing was that from a Console app?
I've tried this article telligent.com/.../1041954.aspxBut I have a problem getting the CSMemberRoleProfileProvider loaded, getting this error: The type initializer for 'CommunityServer.Components.MemberRoleProfileProvider' threw an exception." ("System.TypeInitializationException")Also just tried your example and getting this error: "The service locator has not been initialized" ("System.InvalidOperationException")
Anyone have any idea what I do wrong?
We do not support running the core Telligent Evolution platform binaries outside of a Telligent Evolution website - mainly because they rely on HTTPContext and thus don't work.
To interact with the Telligent Evolution platform from a console app, the recommended and supported route is to use the WebServices APIs.