Hi!
I'm trying ti import an XML file using this script
filename outfile "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml" encoding= 'UTF-8';
libname source xml "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml";
proc http
out = outfile
url = 'https://rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true'
method = 'get';
run;
But an error occured.
May I know how to solve the error? Thank you!
Mmm don't know what to say except that this web site really screws characters sometimes (but not always).
I get the same message as you but after cleaning I can run the code and I get the expected proc http error
ERROR: Host name resolution failed
To clean, delete every space and end-of-line character and add them manually again.
Run each line separately to see which one still contains bad characters.
Can you change your SAS session's encoding into utf-16le? in sas configure file ?
The error point to bad characters in the program itself. This very web site embeds such characters in posted programs.
Admins, anything you can do to avoid this?
Try this cleaned version:
filename outfile 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml' encoding='UTF-8';
libname source xml 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml';
proc http out=outfile url='https://rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true' method='get';run;
Grrr. Yes the rogue characters have been inserted again.
Try the attached file.
Mmm don't know what to say except that this web site really screws characters sometimes (but not always).
I get the same message as you but after cleaning I can run the code and I get the expected proc http error
ERROR: Host name resolution failed
To clean, delete every space and end-of-line character and add them manually again.
Run each line separately to see which one still contains bad characters.
Hi @ChrisNZ
I retyped all and no error occured. But no data on the resuletd XML file as seen on the image below
May I know if you have any idea about resful API on sas and how to code it? I think the step on the link should follow in order to get the data.
That's a a different issue. Now that this is solved and the code can run, best to open a new incident with the appropriate title so the right people can be involved.
Can you run OS command at SAS side ?
x 'curl -k "https://user:password@my_server/webacs/api/v1/data/Devices?.full=true" > C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml ';
Then run my code .
@Ksharp Sorry I didn't see your answer when I asked for the solved flag to be set. I didn't mean to discount your post.
Chris,
That is OK. I really don't care about that.
You must are using IE ? Try Chrome .
Hi @Ksharp,
I tried this code
x 'curl -k "https://user:password@my_server/webacs/api/v1/data/Devices?.full=true" > C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml ';
It says that >C does not recognized.
and I tried only the
x 'curl -k "https://user:password@my_server/webacs/api/v1/data/Devices?.full=true" >OutXML.xml ';
and it was successful. But I don't know where local file it was saved and when I'm searching it it says that no result found.
Do you have any idea where i can found the file?
Thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.