I am making an API call that retrieves a zip file. This was working very nicely when the file was itsy-bitsy. Now it is just tiny and the resulting zip file has nothing in it. I have not changed any code, the zip now just does not contain the one file it should have. My error trap shows I am receiving a 200-ok, so it is not failing there. When I run the exact same API call via Postman it returns with contents as one would expect. What am I missing here?
I am attaching resp.zip which is the result I get from the Postman call and resp(1).zip which is what I am getting from the SAS code below.
%macro testq; %let rootpath=/dcri/cdm/DEV; %include "&rootpath/httperrorcatch.sas"; %let base_url=https://ca1.qualtrics.com; %let logpath=/dcri/cdm/DEV/Qualtrics; filename resp zip "&logpath/resp.zip"; proc http url="&base_url/API/v3/surveys/surveyID/export-responses/fildID/file" method="GET" in='{"format":"json"}' out=resp; HEADERS "x-api-token"="mytoken" "content-type"="application/json"; run; /* catch error */ %prochttp_check_return(code=200,respFile=&logpath/restatus.txt); %mend testq; %testq;
Thanks!
I had MPRINT on already. Nothing there helped. BUT, I figured out the issue.
I declared the file with this statement:
filename resp zip "&logpath/resp.zip";
The file is a zip but for some reason SAS does not pull it down when it is declared as such. I removed the "zip" keyword and it comes as expected.
Set option MPRINT and rerun the code.
Copy from the log the result and paste the code and all the messages into a code box opened with the </>.
I had MPRINT on already. Nothing there helped. BUT, I figured out the issue.
I declared the file with this statement:
filename resp zip "&logpath/resp.zip";
The file is a zip but for some reason SAS does not pull it down when it is declared as such. I removed the "zip" keyword and it comes as expected.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.