Hello,
I am a new user of proc http in SAS.
I have tried the code below and it works
options set=SSLREQCERT="allow";
filename resp temp;
PROC HTTP
METHOD="GET"
URL= 'https://ca1.qualtrics.com/API/v3/surveys'
OUT=resp;
headers
'x-api-token'= '***************ddssXDlLVfJUwJOJfD74l0sc1';
run;
/* Let the JSON engine do its thing */
libname posts JSON fileref=resp;
title "Automap of JSON data";
/* examine resulting tables/structure */
proc datasets lib=posts; quit;
proc print data=posts.alldata; run;
data Basic_survey_info (drop=ordinal_result ordinal_elements);
set posts.result_elements;
obs=ordinal_elements;
run;
From the table Basic_Survey_info, one of the survey id is equal to SV_ahhZznQMwSAyrGK
With this information I would like to execute the script below but in SAS. How to do that ?
options set=SSLREQCERT="allow";
filename resp TEMP;
%let SurveyId=SV_ahhZznQMwSAyrGK;
proc http
url="https://ca1.qualtrics.com/API/v3/surveys/&SurveyId./export-responses"
out=resp;
headers
'x-api-token'= '***********ssXDlLVfJUwJOJfD74l0sc1'
'Content-Type'='application/json';
run;
but I am strill getting an error 404I would start with using POST vs GET in your call.
Some sample code:
filename resp temp;
filename outPP temp;
filename sasPgm 'C:\repos\StoredPrograms\DemoStoredProgram.sas';
/*===================================================================== ;
* Executes SAS code
* curl -X POST "http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?
* sasMachine=Any&email=alan.churchill%40acmeinc.com"
* -H "accept: text/plain"
* -H "Content-Type: multipart/form-data"
* -F "sasFile=@DemoStoredProgram.sas;type=application/x-sas"
*=====================================================================*/ ;
proc http
url = 'http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&email=alan.churchill%40...'
method="POST"
in = sasPgm
ct = "multipart/form-data"
;
headers "Accept"="text/plain"
;
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.