Thanks for your reply. Unfortunately, neither avenues have gotten me the intended result. As for the example you pointed out to. the PROC ends in a "Bad Request". Below is my entire code, and the log snippet. Please see the "error:"invalid_files " message. FYI - I've tried this with 4 different files - XPT,XLSX,SAS7BDAT and a ZIP file. All of them yield the same error message. And yes, these files do have ample data in them. %let boundary=%sysfunc(uuidgen());
filename input1 "../dataraw/f_ae_003.xpt";
%let updestfile = f_ae_003;
data _null_;
infile request end=eof;
file input1;
if _n_ = 1 then do;
put "--&boundary";
put 'Content-Disposition: form-data; name="attributes"';
put ;
put '{"name":"' "&updestfile" '", "parent":{"id":"' "folderID" '"}}';
put "--&boundary";
put 'Content-Disposition: form-data; name="file"; filename="' "&updestfile" '"';
put "Content-Type: application/ASCII";
/* put "Content-Type: application/octet-stream";*/
put ;
end;
input;
put _infile_;
if eof then
do;
put "--&boundary--";
end;
run;
data _null_;
file input1 mod recfm=f lrecl=1;
infile request recfm=f lrecl=1;
input;
put _infile_;
run;
*---------------------------------------------------------------------------------------;
*>> Determine size of request and store in macro variable *****************************;
*---------------------------------------------------------------------------------------;
data _null_;
length bytes $1024;
fid = fopen("input1");
rc = fread(fid);
bytes = finfo(fid, 'File Size (bytes)');
call symput("FileSize",trim(bytes));
rc = fclose(fid);
put bytes;
run;
*---------------------------------------------------------------------------------------;
*>> Submit the Upload request to Box **************************************************;
*---------------------------------------------------------------------------------------;
proc http
url= "&base_uri/repository/container/&containerAID/&version/assetgroup/&agaid/upload"
method = "POST"
out = resp
headerout = headout
in = input1
ct = "multipart/form-data; boundary=&boundary"
;
headers
"Authorization" = "Bearer &ACCESS_TOKEN"
"Content-Length" = "&filesize"
;
debug level=3;
run; As for the SAS documentation link, something seems off (atleast to me) as word POST is not wrapped in quotes. And even when I add quotes, it doesnt "finish" running... Help here will be abundantly appreciated. thanks.
... View more