58%macro mv_getgroupmembers(group
59 ,access_token_var=ACCESS_TOKEN
60 ,grant_type=sas_services
61 ,outds=work.viyagroupmembers
64%
if &grant_type=detect %then %
do;
65 %
if %symexist(&access_token_var) %then %let grant_type=authorization_code;
66 %
else %let grant_type=sas_services;
68%
if &grant_type=sas_services %then %
do;
69 %let oauth_bearer=oauth_bearer=sas_services;
70 %let &access_token_var=;
73%mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
74 and &grant_type ne sas_services
77 ,msg=%str(Invalid value
for grant_type: &grant_type)
83%let base_uri=%mf_getplatform(VIYARESTAPI);
87%let fname1=%mf_getuniquefileref();
88proc http method=
'GET' out=&fname1 &oauth_bearer
89 url=
"&base_uri/identities/groups/&group/members?limit=10000";
91 %
if &grant_type=authorization_code %then %
do;
92 "Authorization"=
"Bearer &&&access_token_var"
94 "Accept"=
"application/json";
97%
if &SYS_PROCHTTP_STATUS_CODE=404 %then %
do;
98 %put NOTE: Group &group not found!!;
102 length ordinal_root 8 ordinal_items 8 version 8
103 id $256 name $256 providerId $32 implicit 8 type $32;
104 call missing(of _all_);
109 %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200)
111 ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
113 %let libref1=%mf_getuniquelibref();
114 libname &libref1 JSON fileref=&fname1;
124 %local itemsds hasvars;
125 %let itemsds=&libref1..items;
127 %
if %sysfunc(exist(&itemsds))=1 %then %
do;
128 %
if %mf_existvar(&itemsds,
id)>0 %then %let hasvars=1;
131 length ordinal_root 8 ordinal_items 8 version 8
132 id $256 name $256 providerId $32 implicit 8 type $32;
133 call missing(of _all_);
134 %
if &hasvars=1 %then %
do;
137 if missing(
id) then delete;
143 libname &libref1 clear;
147filename &fname1 clear;
149%mend mv_getgroupmembers;