BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KatiyarShubham
Calcite | Level 5

Hi All,

I am looking for sas viya rest api to retrieve user group information of a particular user.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
AllanBowe
Barite | Level 11

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)
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

View solution in original post

3 REPLIES 3
AllanBowe
Barite | Level 11

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)
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
joeFurbee
Community Manager

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 XXXVIII, SAS Programming: Getting Started
Wednesday, February 14, 2024, at 10 a.m. ET | #SASBowl

alancox
Obsidian | Level 7

@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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2526 views
  • 4 likes
  • 4 in conversation