06-21-2016 04:24 AM
I'm using the code below to generate the XML file from API and I want to save it to C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml as an xml file. But after the execution the windows explorer of the path just popping up and no file was created
May I know what is the best way to save the xml file in my computer?
x "curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml";
06-21-2016 04:46 AM
What happens when you run the command:
curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml
From the command prompt? Its likely you, or the place where SAS is installed is missing a permission, or the location. You can try:
filename tmp pipe 'curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml'; data test; length buff $2000; infile tmp dlm="¬"; input buff $; run;
That should get the messages back from the system. Maybe there is no path like that on C: (which is where SAS is installed not necessarily your local machine) or maybe you (or the SAS install) doesn't have permission to access that https site.
06-21-2016 05:39 AM
When using the X statement, the command shows the exact details of the XML file. That is, we have a peermission to access the https. Do you know where I can check the SAS missing permission that you are saying?
Also, the log resulted 0 obs using the filename pipe as the image shows.
06-21-2016 05:43 AM
I would check with your IT group. It sounds like SAS is installed on a network, and may need to be given the same permissions as your local machine.
06-21-2016 06:00 AM
Two other things you could try - turn xwait on:
Any OS window that opens will not close automatically, so you may see further information. Also try running it from %sysexec:
And just to check again, if you goto the OS window, and run that command it does work? It just seems strange as SAS local would just push the text out to the OS to run, so it should be exactly the same.
Also, you have spaces inside the path (never recommended!) so you might need to quote the path (i have quoted both the https and path, try either if that doesn't work):
x 'curl -k "https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true" > "C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml"';
06-21-2016 04:52 AM
If you could run
x "curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > want.xml";
then WANT.XML should be under the same folder/directory with curl.exe , Check Where CURL is installed .