42 %macro mv_getgroups(access_token_var=ACCESS_TOKEN
43 ,grant_type=sas_services
44 ,outds=work.viyagroups
47 %
if &grant_type=detect %then %
do;
48 %
if %symexist(&access_token_var) %then %let grant_type=authorization_code;
49 %
else %let grant_type=sas_services;
51 %
if &grant_type=sas_services %then %
do;
52 %let oauth_bearer=oauth_bearer=sas_services;
53 %let &access_token_var=;
55 %put &sysmacroname: grant_type=&grant_type;
56 %mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
57 and &grant_type ne sas_services
60 ,msg=%str(Invalid value
for grant_type: &grant_type)
63 options noquotelenmax;
65 %let base_uri=%mf_getplatform(VIYARESTAPI);
69 %let fname1=%mf_getuniquefileref();
70 %let libref1=%mf_getuniquelibref();
72 proc http method=
'GET' out=&fname1 &oauth_bearer
73 url=
"&base_uri/identities/groups?limit=10000";
75 %
if &grant_type=authorization_code %then %
do;
76 "Authorization"=
"Bearer &&&access_token_var"
78 "Accept"=
"application/json";
81 %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200)
83 ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
85 libname &libref1 JSON fileref=&fname1;
94 filename &fname1 clear;
95 libname &libref1 clear;