How to pass token, username & password in proc https GET method?
For post method, i am able to pass token, username & password and getting desired output. But for get method, it is giving error.
Can anyone share me syntax for passing token, username & password in proc https GET method ?
In a GET method the server isn't expecting a "payload" (what you would specify in the IN= option on PROC HTTP), so you would place the credentials argument on the URL or...if it's Basic Auth...on the WEBUSERNAME/WEBUSERPASSWORD options.
filename resp temp;
proc http
url="https://httpbin.org?user=myusername&password=mypassword&token=ABC1234"
method='GET'
out=resp;
run;
Sometimes, the API expects a token to be specified as part of the header, which you place in the HEADERS statement:
/* authtoken retrieved in previous step */
filename resp temp;
proc http
url="https://httpbin.org/api/2.0/search?q=&query."
method="GET"
out=resp
;
headers
"Authorization"="Bearer &authtoken.";
run;
This webinar/article covers a lot of the basics.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.