Hi,
I am trying to upload a csv file from SAS to Sharefile dropbox using the below code.
When I run the below code, I get 'Physical file does not exist' error. I guess it is not able to translate/read the dropbox URL.
Has anyone done something similar before?
filename _inbox "https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX";/* Path of the Folder where we wish to upload the document */
filename class "/staff/XXX/userid/test.txt"; /* Path of the Folder where the document is present */
proc http method="post"
url="https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX"
webusername="email@xxx.nz" webpassword="XXXX"
in=class
out=_inbox
proxyhost="http://xxxx.corp.xxx.abc.nz"
proxyport=8080 in=class
ct="application/x-www-form-urlencoded"
verbose
;
run;
Log snippet as below -
URL = https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX
Proxy Host = http://xxxx.corp.xxx.abc.nz
Proxy Port = 8080
METHOD = post
CT = application/x-www-form-urlencoded
In = /staff/xxxx/userid/test.txt
Out =
/gpfs/sasfs/sasconfig/func/Lev1/DevUnit/https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX
Web Auth User Name = email@xxx.nz
38 run;
ERROR: Physical file does not exist,
/gpfs/sasfs/sasconfig/func/Lev1/DevUnit/https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX
ERROR: Generic HTTP Client Error
NOTE: PROCEDURE HTTP used (Total process time):
real time 0.28 seconds
cpu time 0.00 seconds
2 The SAS System 10:55 Wednesday, September 26, 2018
NOTE: The SAS System stopped processing this step because of errors.
Thanks
The out= option has to point to a local file where the returns from the HTTP request are to be stored. The target for the post is solely in the url= option.
A filename without a specific engine always has to point to a file in the local filesystem. Protocols (http://) do not work, and since the pathname in the filename statement does not satisfy the requirements of an absolute pathname, it is considered relative and appended to the current working directory of the SAS process.
PS consult the documentation: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=proc&docsetTarget=n197g47...
Aside from @Kurt_Bremser's advice, I suspect that you will not be able to upload a file with Basic Auth (the webuser/password approach). The ShareFile API, like Box or Google Drive, will require OAuth2 -- which might require that you register an "app" as a developer and then get an access token. This is needed because you'll need to grant the app the appropriate permissions to upload a file to your account. (Things have become lots more complex since the FTP days, right?)
Some services allow you to register a webhook that makes this a little simpler -- not sure if ShareFile is one of those.
It's definitely possible to do, just some more code.
See this thread about using the Box API.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.