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