BookmarkSubscribeRSS Feed
bk4
Calcite | Level 5 bk4
Calcite | Level 5

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

3 REPLIES 3
Kurt_Bremser
Super User

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.

ChrisHemedinger
Community Manager

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.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

SAS Innovate 2025: Register Now

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!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1390 views
  • 2 likes
  • 3 in conversation