BookmarkSubscribeRSS Feed
aomy82
Fluorite | Level 6

Hi All,

 

I am trying to get data in XML format from an API.  But the data I get form this API is always in JSON format.

 

I confirmed with the API's developers that it can return data in both JSON and XML depending on the request

 

Here is the code I am using:

FILENAME QAOS "/haexample/Example_Dir/Example.xml";

 

PROC HTTP

URL = "http://example.cnn.com/api/Something?format=xml"

OUT = QAOS

METHOD= 'GET'

;

RUN;

 

What am I missing here? Please help.

 

Regards,

Ahmed

 

 

2 REPLIES 2
Patrick
Opal | Level 21

@aomy82

Get from your API developers a working sample get request (the URL) where they confirm that you get an XML back.

Reeza
Super User

Most of the time you can take the API call, post it in a browser URL bar and get the response. Make sure that works first and then verify that PROC HTTP works. FYI - I used it last week so it definitely works as intended. 

 

Another check, make sure your version of SAS supports what you're trying to do but I think PROC HTTP is pretty old. This is unlikely...but if you're not sure post your SAS version (i.e. 9.4 TS1M4)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1772 views
  • 0 likes
  • 3 in conversation