Hi All,
I am looking for sas viya rest api to retrieve user group information of a particular user.
Thanks in advance!
Hi Katiyar,
The endpoint you need is this one:
&base_uri/identities/users/&user/memberships?limit=100
If you're looking to do this in SAS, there is already a macro in the @sasjs/core library - mv_getusergroups.sas
Example usage:
/* compile macros */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;
/* extract groups for a particular user */
%mv_getusergroups(&sysuserid,outds=users)
Hi Katiyar,
The endpoint you need is this one:
&base_uri/identities/users/&user/memberships?limit=100
If you're looking to do this in SAS, there is already a macro in the @sasjs/core library - mv_getusergroups.sas
Example usage:
/* compile macros */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;
/* extract groups for a particular user */
%mv_getusergroups(&sysuserid,outds=users)
Hi @KatiyarShubham,
I wanted to follow up @AllanBowe's response with the following disclaimer:
The identities API is not publicly available. PLEASE UNDERSTAND: as the API is not public there is a higher risk of breaking changes without warning. Since the REST API is currently not supported, SAS Technical Support will not provide any support if you have any additional questions about the usage of the REST API identities. The API may become public/documented/supported in the future, but until then, will need to be used with this understanding.
You may also want to look at the SAS Viya CLI. There are multiple commands supporting identities along with examples. The pyviyatools GitHub repository supports the CLI from a Python perspective.
Thanks,
Joe
Join us for SAS Community Trivia
SAS Bowl XLVIII, All Things Models
Wednesday, February 19, 2024, at 10:00 a.m. ET | #SASBowl
@joeFurbee it's an interesting shift in what is & isn't officially documented & therefore supported when it comes to the Viya APIs. The admin CLI provides scope to see what's happening under the covers when using the "--verbose" option where you'll see the identities API calls doing their stuff using the examples you link to, compared to what can be seen directly in the python scripts such as listgroupsandmembers.py
Both certainly provided the starting point for creating customized processes.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.