BookmarkSubscribeRSS Feed
jakemyers2
Fluorite | Level 6

Hello, 

I have been scouring now for a couple hours the posts and have yet to find anything that works. I am currently pushing to an API parameters which then gives me a JSON presigned URL and will then use that URL to upload a file. I am struggling because I am not the best at SAS and am struggling to know where my issues lie. I am able to get to the proc http post, and think the JSON file containing the presigned url from aws is in the resp variable because I am able to see it in the log. The format of the JSON file is as follows

{"presigned_url": "https:blahblah", "uuid": "blah", "file": "blah", "var4":"blah"}

 

I think that is my current issue as I cant go from this JSON into putting just the url into my next PROC HTTP request.

For reference in python I do all of that in one line 

 

signed_url = json.loads(response.content)['presigned_url']
 
filename in temp;
data _null_;  
	file in;
	put "value=key&"
		"value2=key2&"
		"value3=key3&"
run;

filename resp temp;

proc http
	method="POST"
	url="api.com"
	ct="application/x-www-form-urlencoded"
	in= in
	out= resp
	proxyhost="x"
	proxyport=1;
run;

libname lib JSON fileref=resp;

filename rest temp;
filename input "fileToUpload.data";

proc http 
   method="PUT" 
   url=lib.contents.presigned_url 
   in= input
   out=rest
run;

 

2 REPLIES 2
Patrick
Opal | Level 21

If you're more comfortable with Python then this blog should interest you: SAS or Python? Why not use both?

 

jakemyers2
Fluorite | Level 6
I am more comfortable in python but due to the nature of the project it has to be done in SAS.

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
  • 1236 views
  • 0 likes
  • 2 in conversation