<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416816#M67653</link>
    <description>&lt;P&gt;Tagging&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/124306"&gt;@JosephHenry&lt;/a&gt;&amp;nbsp;- might be able to help.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2017 19:17:15 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2017-11-28T19:17:15Z</dc:date>
    <item>
      <title>Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/413797#M67475</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based upon a variety of helpful postings, I am successfully using SAS and PROC HTTP to make REST API calls to Box.com.&amp;nbsp; In the "working" column are getting OAUTH tokens, finding file and folder IDs, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the "close but not quite working" column is using&amp;nbsp;Box.com's File upload APIs (see &lt;A href="https://developer.box.com/reference#upload-a-file" target="_self"&gt;here&lt;/A&gt;).&amp;nbsp; The file upload API uses a multi-part form to upload the file data.&amp;nbsp; Based in part on things I read &lt;A href="https://communities.sas.com/t5/SAS-Procedures/multipart-form-data-REST-API-POST-in-PROC-HTTP-failing/td-p/325284" target="_self"&gt;here&lt;/A&gt;, I developed code that partially works.&amp;nbsp;&amp;nbsp;In the code below, I can upload a text file to Box and it works fine. When I try to use this same code to upload a binary file (say, an *.egp file), the upload does not work&amp;nbsp;correctly and what gets created is a corrupted file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see in the code where the content-type is defined in the sub-form.&amp;nbsp; Originally, I used "text/plain" and then switched to "application/octet-stream" so that it&amp;nbsp;would expect binary data for the sub-form (note, when I use cURL to successfully upload the file, "&lt;SPAN&gt;octet-stream"&amp;nbsp;&lt;/SPAN&gt;is what it uses for the content-type).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although I don't get an errors (SAS or Box.com), the file is still not correct.&amp;nbsp; Looking inside the REQUEST file that gets created, the&amp;nbsp;file data is largely absent and&amp;nbsp;I think the issue may have to do with the infile statement not properly reading binary data.&amp;nbsp; I tried to modify the inflie statement to us recfm=N, but that results in errors from SAS since it appears the put statements are incompatible with binary file processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm stuck.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Eric&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*---------------------------------------------------------------------------------------;
  *&amp;gt;&amp;gt; Create file request  ***************************************************************;
  *---------------------------------------------------------------------------------------;
  data _null_;
    infile copyfile end=eof;
    file request;

      if _n_ = 1 then do;
        put "--&amp;amp;boundary"; 
        put 'Content-Disposition: form-data; name="attributes"';
        put ;
        put '{"name":"' "&amp;amp;updestfile" '", "parent":{"id":"' "&amp;amp;boxfolderID" '"}}';
        put "--&amp;amp;boundary"; 
        put 'Content-Disposition: form-data; name="file"; filename="' "&amp;amp;updestfile" '"';

        put "Content-Type: text/plain";
/*        put "Content-Type: application/octet-stream";*/
        put ;
      end;

    input;
    put _infile_;

    if eof then
     do;
       put "--&amp;amp;boundary--"; 
     end;
  run;


  *---------------------------------------------------------------------------------------;
  *&amp;gt;&amp;gt; Determine size of request and store in macro variable  *****************************;
  *---------------------------------------------------------------------------------------;
  data _null_;
    length bytes $1024;
    fid = fopen("request");
    rc = fread(fid);
    bytes = finfo(fid, 'File Size (bytes)');
    call symput("FileSize",trim(bytes));
    rc = fclose(fid);
    put bytes;
  run;

  *---------------------------------------------------------------------------------------;
  *&amp;gt;&amp;gt; Submit the Upload request to Box  **************************************************;
  *---------------------------------------------------------------------------------------;
  proc http
      url="https://upload.box.com/api/2.0/files/content"
        method    = "POST"
        out       = resp
        headerout = resphdrs
        in        = request
        ct        = "multipart/form-data; boundary=&amp;amp;boundary"
    ;
    headers
      "Authorization"  = "Bearer &amp;amp;UPaccesstoken"
      "Content-Length" = "&amp;amp;filesize"
    ;

  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 21:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/413797#M67475</guid>
      <dc:creator>EStrom1</dc:creator>
      <dc:date>2017-11-15T21:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416808#M67647</link>
      <description>&lt;P&gt;UPDATE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much closer to a fix, but not quite there.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added an IGNOREDOSEOF option to the infile statement, and it now (almost) faithfully reads all the binary characters from the source file and transfers them to the PROC HTTP request file.&amp;nbsp; The file gets created in Box.com, however, the file is still corrupt.&amp;nbsp; Downloading the file from Box and comparing it (hex) to the original revealed the difference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a section of screenshot that shows an example.&amp;nbsp; The left side of the screen is the source file, the right side is the file that gets created in Box.&amp;nbsp; The red arrow points to where there is a null character &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hex comparison" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16883i741EB53951A8C866/image-size/large?v=v2&amp;amp;px=999" role="button" title="Box Rest API file compare.jpg" alt="Hex comparison" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Hex comparison&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in the source.&amp;nbsp; The green arrow on the right (destination file) shows where this gets converted to a carriage return (0D hex).&amp;nbsp; This happens throughout the file. As far as I can tell, this is the only difference between the two files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an option in SAS that controls this behavior?&amp;nbsp; I see there is a TERMSTR option, but that does not seem to control this specific behavior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Eric&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 18:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416808#M67647</guid>
      <dc:creator>EStrom1</dc:creator>
      <dc:date>2017-11-28T18:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416816#M67653</link>
      <description>&lt;P&gt;Tagging&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/124306"&gt;@JosephHenry&lt;/a&gt;&amp;nbsp;- might be able to help.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416816#M67653</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-11-28T19:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416837#M67654</link>
      <description>&lt;P&gt;When working with Binary files you kind of need to "force" the datastep to read and write a byte at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the way you do this is with this little trick:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;infile copyfile recfm=1 lrecl=1;
file request recfm=1 lrecl=1;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But since you need to mix text and binary, it would probably be best to run multiple datasteps using mod&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This might work for you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    file request termstr=CRLF;
    if _n_ = 1 then do;
        put "--&amp;amp;boundary"; 
        put 'Content-Disposition: form-data; name="attributes"';
        put ;
        put '{"name":"' "&amp;amp;updestfile" '", "parent":{"id":"' "&amp;amp;boxfolderID" '"}}';
        put "--&amp;amp;boundary"; 
        put 'Content-Disposition: form-data; name="file"; filename="' "&amp;amp;updestfile" '"';
        put "Content-Type: application/octet-stream";

        put ;
      end;
run;

data _null_;
    file request mod recfm=f lrecl=1;
    infile copyfile  recfm=f lrecl=1;
    
    input;
    put _infile_;
run;

data _null_;
    file request mod termstr=CRLF;
    put "--&amp;amp;boundary--"; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 20:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416837#M67654</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-11-28T20:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416872#M67662</link>
      <description>&lt;P&gt;Awesome.&amp;nbsp; This worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I inserted a hard return &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;put ;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; ) immediately before the final boundary put statement in the last data step&lt;/SPAN&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 20:46:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416872#M67662</guid>
      <dc:creator>EStrom1</dc:creator>
      <dc:date>2017-11-28T20:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416874#M67663</link>
      <description>Glad I could help. &lt;BR /&gt;&lt;BR /&gt;I am working on getting multipart directly integrated into proc http, so hopefully in the future it will be easier.</description>
      <pubDate>Tue, 28 Nov 2017 20:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/416874#M67663</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-11-28T20:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495488#M72347</link>
      <description>&lt;P&gt;I'm running into this same problem, but what you're proposing doesn't work.&amp;nbsp; I get unprocessible entity errors...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let boundary=%sysfunc(uuidgen());
	
filename in '/folders/myfolders/test.txt';
	
data _null_;
	
    file in termstr=CRLF 
    	recfm=f lrecl=1 
    	;&lt;BR /&gt;&lt;BR /&gt;    infile "&amp;amp;path./&amp;amp;filename." end=eof 
	recfm=f lrecl=1 
	termstr=CRLF;
			
    if _n_ = 1 then do;
	put "--&amp;amp;boundary.";
	put 'Content-Disposition: form-data; name="file"; filename="data.xlsx"';
	put 'Content-Type: application/octet-stream';
	put ;
    end;
		
    input;
    put _infile_;
	
    if eof then do;
	put ;
	put "--&amp;amp;boundary.--";
    end;
		
run;
	
proc http 
    method="post" &lt;BR /&gt;    url = "&amp;amp;url."
    in = in
    ct="multipart/form-data; boundary=&amp;amp;boundary."
    out = out 
    headerout = hdrout 
    headerin= hdrin
    HEADEROUT_OVERWRITE; 
    ; 
run; 
	  &lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495488#M72347</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-13T20:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495495#M72348</link>
      <description>&lt;P&gt;What does your proc HTTP code look like?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495495#M72348</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2018-09-13T20:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495497#M72349</link>
      <description>&lt;P&gt;I've just updated the original post to include the code.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495497#M72349</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-13T20:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495502#M72350</link>
      <description>&lt;P&gt;If it's helpful, the response I'm getting back is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HTTP/1.1 422 UNPROCESSABLE ENTITY
Server: openresty
Date: Thu, 13 Sep 2018 20:23:10 GMT
Content-Type: application/json
Content-Length: 51
Connection: keep-alive
X-Frame-Options: SAMEORIGIN

&lt;/PRE&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{"message": "The request did not contain any file"}&lt;/PRE&gt;&lt;P&gt;Incidentally, I'm certain that the excel file is valid.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495502#M72350</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-13T20:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495516#M72353</link>
      <description>&lt;P&gt;you are having the same problem as the OP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    file in termstr=CRLF;
	if _n_ = 1 then do;
		put "--&amp;amp;boundary.";
		put 'Content-Disposition: form-data; name="file"; filename="data.xlsx"';
		put 'Content-Type: application/octet-stream';
		put ;
     end;
run;

data _null_;
    file in mod recfm=f lrecl=1;
    infile "&amp;amp;path./&amp;amp;filename." recfm=f lrecl=1;
    
    input;
    put _infile_;
run;

data _null_;
    file in mod termstr=CRLF;
    put "--&amp;amp;boundary--"; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495516#M72353</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2018-09-13T20:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495541#M72356</link>
      <description>&lt;P&gt;Yep... I already tried that.&amp;nbsp; Same result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HTTP/1.1 422 UNPROCESSABLE ENTITY
Server: openresty
Date: Thu, 13 Sep 2018 22:34:03 GMT
Content-Type: application/json
Content-Length: 51
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
Set-Cookie: SERVERID=green; path=/&lt;/PRE&gt;&lt;P&gt;and&lt;/P&gt;&lt;PRE&gt;{"message": "The request did not contain any file"}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 22:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495541#M72356</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-13T22:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495542#M72357</link>
      <description>&lt;P&gt;I checked the file with was received by the server.&amp;nbsp; It's definitely corrupted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 22:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495542#M72357</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-13T22:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495647#M72368</link>
      <description>What version of SAS are you running?&lt;BR /&gt;&lt;BR /&gt;My tests using the code that I posted all produces the correct multiform output.&lt;BR /&gt;&lt;BR /&gt;What are the additional headers you are sending?</description>
      <pubDate>Fri, 14 Sep 2018 12:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495647#M72368</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2018-09-14T12:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495649#M72369</link>
      <description>&lt;P&gt;I'm using the latest academic version.&amp;nbsp; The only header that I'm sending is my API token.&amp;nbsp; It is a text file with the following content:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Authentication: Token&amp;nbsp;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;XXXX&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 12:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495649#M72369</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-14T12:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495652#M72370</link>
      <description>Are you posing to a public URL that I could try?&lt;BR /&gt;&lt;BR /&gt;Is there and example using cURL? if so, can you post it?</description>
      <pubDate>Fri, 14 Sep 2018 12:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495652#M72370</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2018-09-14T12:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495659#M72373</link>
      <description>&lt;P&gt;Here is&amp;nbsp;a curl request that works just fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -v -X POST --header "Authorization: Token ${TOKEN}" -F file=@/home/data/tests/testdata/dataset.xlsx ${URL}&lt;/PRE&gt;&lt;P&gt;Sadly, it's not a public URL at the moment.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 12:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495659#M72373</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-14T12:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495670#M72374</link>
      <description>&lt;P&gt;So it looks like one small thing was missing. there needed to be an extra CRLF before the final boundary, which can be achieved with one additional "put ;" before the output of the final boundary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the entire code that I ran in my tests:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 

%let boundary=%sysfunc(uuidgen());
	
filename in "/temp/multipart_data.dat";
	
data _null_;
    file in termstr=CRLF;
	if _n_ = 1 then do;
		put "--&amp;amp;boundary.";
		put 'Content-Disposition: form-data; name="file"; filename="data.xlsx"';
		put 'Content-Type: application/octet-stream';
		put ;
     end;
run;

data _null_;
    file in mod recfm=f lrecl=1;
	infile "/temp/tags" recfm=f lrecl=1;
    
    input;
    put _infile_;
run;

data _null_;
    file in mod termstr=CRLF;
	put;
    put "--&amp;amp;boundary--"; 
run;

proc http 
    method="post" 
    url = "httpbin.org/post"
    in = in
    ct="multipart/form-data; boundary=&amp;amp;boundary."
    HEADEROUT_OVERWRITE; 
    ; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495670#M72374</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2018-09-14T13:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495678#M72375</link>
      <description>&lt;P&gt;Not for nothing...but I found that the Box APIs are very picky.&amp;nbsp; No wiggle room in the implementation to vary from the exact content it expects.&amp;nbsp; That's true for the APIs to get a refresh token, query content, and post content.&amp;nbsp; I've been trying (off and on) to work up a SAS example, but it's tricky to find a path that I'm confident will work in most scenarios.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495678#M72375</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-09-14T13:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP / Box.com REST API / Trouble with uploading binary files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495759#M72380</link>
      <description>&lt;P&gt;That did the trick. Thanks for the help.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;When is support for multipart files coming to SAS?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 16:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/m-p/495759#M72380</guid>
      <dc:creator>gvm</dc:creator>
      <dc:date>2018-09-14T16:48:58Z</dc:date>
    </item>
  </channel>
</rss>

