46%macro mv_getgroupmembers(group
47 ,access_token_var=ACCESS_TOKEN
48 ,grant_type=sas_services
49 ,outds=work.viyagroupmembers
52%
if &grant_type=detect %then %
do;
53 %
if %symexist(&access_token_var) %then %let grant_type=authorization_code;
54 %
else %let grant_type=sas_services;
56%
if &grant_type=sas_services %then %
do;
57 %let oauth_bearer=oauth_bearer=sas_services;
58 %let &access_token_var=;
61%mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
62 and &grant_type ne sas_services
65 ,msg=%str(Invalid value
for grant_type: &grant_type)
71%let base_uri=%mf_getplatform(VIYARESTAPI);
75%let fname1=%mf_getuniquefileref();
76proc http method=
'GET' out=&fname1 &oauth_bearer
77 url=
"&base_uri/identities/groups/&group/members?limit=10000";
79 %
if &grant_type=authorization_code %then %
do;
80 "Authorization"=
"Bearer &&&access_token_var"
82 "Accept"=
"application/json";
85%
if &SYS_PROCHTTP_STATUS_CODE=404 %then %
do;
86 %put NOTE: Group &group not found!!;
89 call missing(of _all_);
93 %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200)
95 ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
97 %let libref1=%mf_getuniquelibref();
98 libname &libref1 JSON fileref=&fname1;
103 libname &libref1 clear;
107filename &fname1 clear;
109%mend mv_getgroupmembers;