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!
It's possible you have a proxy gateway that you need to account for. See some tips here.
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.
It's possible you have a proxy gateway that you need to account for. See some tips here.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.