60 %macro mv_getusers(outds=work.mv_getusers
61 ,access_token_var=ACCESS_TOKEN
62 ,grant_type=sas_services
65 %
if &grant_type=detect %then %
do;
66 %
if %symexist(&access_token_var) %then %let grant_type=authorization_code;
67 %
else %let grant_type=sas_services;
69 %
if &grant_type=sas_services %then %
do;
70 %let oauth_bearer=oauth_bearer=sas_services;
71 %let &access_token_var=;
73 %put &sysmacroname: grant_type=&grant_type;
74 %mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
75 and &grant_type ne sas_services
78 ,msg=%str(Invalid value
for grant_type: &grant_type)
81 options noquotelenmax;
84 %let base_uri=%mf_getplatform(VIYARESTAPI);
88 %let fname1=%mf_getuniquefileref();
89 %let libref1=%mf_getuniquelibref();
91 proc http method=
'GET' out=&fname1 &oauth_bearer
92 url=
"&base_uri/identities/users?limit=10000";
93 %
if &grant_type=authorization_code %then %
do;
94 headers
"Authorization"=
"Bearer &&&access_token_var"
95 "Accept"=
"application/json";
98 headers
"Accept"=
"application/json";
102 %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200)
104 ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
106 libname &libref1 JSON fileref=&fname1;
113 filename &fname1 clear;
114 libname &libref1 clear;