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

Hi!

 

I’m trying to use a REST service with basic authentication (no proxy server involved) to ger information in json format using PROC HTTP.

 

However, I can’t connect successfully to the web server using the procedure. I’ve already verified the procedure’s official documentation and I read the guide RESTfull web services for beginners, but I can’t find any syntax errors (I’ve already tried different ways).

 

Someone could please help me, indicating what could be wrong or how I could get successfully connected using basic authentication? I’m using Guide 8.2 version.

 

Here’s an example of the code I’m trying to submit:

 

filename TESTE temp encoding='utf-8';

proc http
	url="https://............."
	method="GET"
	auth_basic
	WEBPASSWORD="XXXXXXXXXXXX"
	WEBUSERNAME="nome_usuario"
	out=TESTE
	TIMEOUT=30
	ct="application/json";
run;

Thanks a lot!

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

It's possible you have a proxy gateway that you need to account for. See some tips here.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

Have you tested that you can work with PROC HTTP to reach websites in your environment? Try this code:

 

filename resp temp;
 
/* Neat service from Open Notify project */
proc http 
 url="http://api.open-notify.org/astros.json"
 method= "GET"
 out=resp;
run;
 
/* Assign a JSON library to the HTTP response */
libname space JSON fileref=resp;
 
/* Print result, dropping automatic ordinal metadata */
title "Who is in space right now? (as of &sysdate)";
proc print data=space.people (drop=ordinal:);
run;

If that works, make sure the REST service you're using can use basic authentication (user and password), instead of a more elaborate token-based authentication.

 

This webinar and links might help.

 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Felipe_bortolo
Fluorite | Level 6
Thanks, Chris! Actually it didn't work… Do you have any suggestions about possible reasons? It would be helpful for me to address the problem here.

Thanks again!
ChrisHemedinger
Community Manager

It's possible you have a proxy gateway that you need to account for. See some tips here.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 2286 views
  • 2 likes
  • 2 in conversation