BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
evaleah
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
evaleah
Obsidian | Level 7

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.

View solution in original post

2 REPLIES 2
ballardw
Super User

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 </>.

 

 

evaleah
Obsidian | Level 7

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 841 views
  • 0 likes
  • 2 in conversation