BookmarkSubscribeRSS Feed
Amit2
Calcite | Level 5

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 ?

1 REPLY 1
ChrisHemedinger
Community Manager

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.

SAS Innovate 2025: Call for Content! Submit your proposals before Sept 16. Accepted presenters get amazing perks to attend the conference!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 439 views
  • 0 likes
  • 2 in conversation