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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

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.

 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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