BookmarkSubscribeRSS Feed
☑ This topic is solved. 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.

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.

 

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 INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1144 views
  • 2 likes
  • 2 in conversation