<?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: upload an excel file to box.com using PROC HTTP in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/425241#M68258</link>
    <description>&lt;P&gt;Update: I have sas9.4 M5 installed. First I used 'debug level=1; the log has no difference comparing with without this statement; when I changed to 'level=2', SAS crashed as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17661i13F4F2FB33BFF8B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My SAS version:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 562px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17662iD4B659A4F8C0E43B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jan 2018 14:34:10 GMT</pubDate>
    <dc:creator>HelenLondon</dc:creator>
    <dc:date>2018-01-05T14:34:10Z</dc:date>
    <item>
      <title>upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424118#M68158</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am new to use PROC HTTP. I found a post&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Box-com-REST-API-Trouble-with-uploading-binary-files/td-p/413797" target="_self"&gt;here&lt;/A&gt; is very useful to my situation but I couldn't make it work for me. I have successfully uploaded an excel file via cURL as below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;curl &lt;A href="https://upload.box.com/api/2.0/files/content" target="_blank"&gt;https://upload.box.com/api/2.0/files/content&lt;/A&gt; -H "Authorization: Bearer &amp;lt;my token&amp;gt;" -X POST \&lt;BR /&gt;&amp;nbsp;-F attributes="{\"name\":\"test.xlsx\", \"parent\":{\"id\":\"43742861365\"}}" \&lt;BR /&gt;&amp;nbsp;-F file=@c:\temp\test.xlsx&lt;BR /&gt;So my environment is not an issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can upload text files successfully using below codes, but get '400 Bad Request' when I try to upload an excel file or other binary files:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename copyfile "c:\temp\test.xlsx" ; &lt;BR /&gt;filename request TEMP ;&lt;BR /&gt;%let boundary=foobar;&lt;BR /&gt;%let boxfolderID=43742861365;&lt;BR /&gt;%let updestfile=upload.xlsx;&lt;BR /&gt;%let my_token=12345dfdgrfhggfnhgn;&lt;/P&gt;
&lt;P&gt;filename resptext temp;&lt;BR /&gt;filename resphdrs temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*box.com upload require json two parts for&amp;nbsp;multipart/form-data;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file request termstr=CRLF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_ = 1 then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "--&amp;amp;boundary"; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'Content-Disposition: form-data; name="attributes"';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '{"name":"' "&amp;amp;updestfile" '", "parent":{"id":"' "&amp;amp;boxfolderID" '"}}';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "--&amp;amp;boundary"; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'Content-Disposition: form-data; name="file"; filename="' "&amp;amp;updestfile" '"';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "Content-Type: application/vnd.ms-excel";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*put "Content-Type: application/octet-stream";*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*append my binary file;&lt;BR /&gt;data _null_;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file request mod recfm=n;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile copyfile recfm=n;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input c $CHAR1.; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put c $CHAR1. @@; &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file request mod termstr=CRLF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "--&amp;amp;boundary--"; &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length bytes $1024;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fid = fopen("request");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = fread(fid);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bytes = finfo(fid, 'File Size (bytes)');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput("FileSize",trim(bytes));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = fclose(fid);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put bytes;&lt;BR /&gt;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;proc http&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url="&lt;A href="https://upload.box.com/api/2.0/files/content" target="_blank"&gt;https://upload.box.com/api/2.0/files/content&lt;/A&gt;"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; method&amp;nbsp;&amp;nbsp;&amp;nbsp; = "POST"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = resptext&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; headerout = resphdrs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = request&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = "multipart/form-data; boundary=&amp;amp;boundary;Content-Length=&amp;amp;filesize;Content-MD5" &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; headers &amp;nbsp; &amp;nbsp;&amp;nbsp; "Authorization"&amp;nbsp; = "Bearer &amp;amp;my_token" &amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am not sure why it is not working. The same codes works fine for .csv files, but not .xlsx files. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Helen&lt;/P&gt;</description>
      <pubDate>Sat, 30 Dec 2017 20:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424118#M68158</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2017-12-30T20:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424279#M68161</link>
      <description>&lt;P&gt;Assuming that you have a local SAS installation: have to tried using x-command with the tested curl-command?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 08:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424279#M68161</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-01-02T08:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424299#M68162</link>
      <description>&lt;P&gt;Hi Andrea,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. I tested it using x command on my local SAS and it works well. But I would like to use PROC HTTP since I will use it on our SAS server environment eventually. Any ideas something wrong with my codes on PROC HTTP part? Thanks again,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Helen&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 11:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424299#M68162</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-02T11:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424489#M68198</link>
      <description>&lt;P&gt;Helen: Can you please share the piece of code you submitted via X command. I'm curious how you dealt with quotes.&lt;/P&gt;&lt;P&gt;I'm doing something similar Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 01:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424489#M68198</guid>
      <dc:creator>abjain</dc:creator>
      <dc:date>2018-01-03T01:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424552#M68199</link>
      <description>&lt;P&gt;of course. For windows, you need to add '\' before double quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x 'curl &lt;A href="https://upload.box.com/api/2.0/files/content" target="_blank"&gt;https://upload.box.com/api/2.0/files/content&lt;/A&gt; \&lt;BR /&gt;&amp;nbsp;-H "Authorization: Bearer &amp;lt;my_token&amp;gt;" -X POST \&lt;BR /&gt;&amp;nbsp;-F attributes="{\"Content-Disposition\": \"form-data\",\"Content-Type\": \"application/octet-stream\",\"name\":\"test.xlsx\", \"parent\":{\"id\":\"&amp;lt;folder_ID&amp;gt;\"}}" \&lt;BR /&gt;&amp;nbsp;-F file=@c:\temp\test.xlsx' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anybody explain why my proc http codes is not working? Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Helen&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 12:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424552#M68199</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-03T12:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424578#M68200</link>
      <description>&lt;P&gt;If it works with CSV but not Excel, then I'm suspicious of the DATA step that copies the binary content.&amp;nbsp; Your version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;   
    file request mod recfm=n;
    infile copyfile recfm=n;
    input c $CHAR1.; 
    put c $CHAR1. @@; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any reason you didn't go with the version in the thread you cited?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    file request mod recfm=f lrecl=1;
    infile copyfile  recfm=f lrecl=1;
    
    input;
    put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The CHAR format does not trim spaces, but with a width of 1 that shouldn't cause an issue.&amp;nbsp; And I think the width of 1 would be just 1 byte even on UTF-8 sessions, but I haven't tested.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 14:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424578#M68200</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-01-03T14:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424584#M68201</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried that codes in the first place and got same 400 bad request.&amp;nbsp; I suspect something wrong when I combine plain texts with binary file contents inserted between. So&amp;nbsp;I played different copy binary codes without any luck. The codes for copying binary file which I have tried as below:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; _null_&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt;&lt;SPAN&gt; request &lt;/SPAN&gt;&lt;SPAN class="token function"&gt;mod&lt;/SPAN&gt;&lt;SPAN&gt; recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f lrecl&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; copyfile recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f lrecl&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN&gt; _infile_&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; _null_&lt;/SPAN&gt;; &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt;&lt;SPAN&gt; request &lt;/SPAN&gt;&lt;SPAN class="token function"&gt;mod&lt;/SPAN&gt;&lt;SPAN&gt; recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; copyfile recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; c &lt;/SPAN&gt;$&lt;SPAN&gt;CHAR1&lt;/SPAN&gt;.; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN&gt; c &lt;/SPAN&gt;$&lt;SPAN&gt;CHAR1&lt;/SPAN&gt;. @@; &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; _null_&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt;&lt;SPAN&gt; request &lt;/SPAN&gt;&lt;SPAN class="token function"&gt;mod&lt;/SPAN&gt;&lt;SPAN&gt; recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; copyfile recfm&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; c &lt;/SPAN&gt;&lt;SPAN&gt;$&lt;/SPAN&gt;&lt;SPAN&gt;CHAR1&lt;/SPAN&gt;&lt;SPAN&gt;.@&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN&gt; c &lt;/SPAN&gt;&lt;SPAN&gt;$&lt;/SPAN&gt;&lt;SPAN&gt;CHAR1&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt; &lt;SPAN&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Is there anything I can try further? thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Helen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 15:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424584#M68201</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-03T15:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424645#M68208</link>
      <description>&lt;P&gt;I notice that you also have "Content-MD5" in the POST, but I didn't see where you computed/specified the MD5 hash for the file.&amp;nbsp; Is it required for this Box API?&amp;nbsp; I don't see reference to it in the cURL command, but maybe that's handled by cURL under the covers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And to be clear, the headersout file is consistently just "400 bad request" -- not a more specific error?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you have the latest SAS 9.4 maint 5, &lt;A href="http://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n0i2ek87s12e7mn1h2q3h0mywkl1.htm&amp;amp;locale=en" target="_self"&gt;you could try the DEBUG statement in PROC HTTP&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 17:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424645#M68208</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-01-03T17:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424670#M68216</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually I saw Box.com (&lt;A href="https://developer.box.com/reference#upload-a-file" target="_self"&gt;here) &lt;/A&gt;saying 'A different Box URL, &lt;A href="https://upload.box.com/api/2.0/files/content" target="_self"&gt;https://upload.box.com/api/2.0/files/content&lt;/A&gt;, handles uploads. This API uses the &lt;A href="http://hc.apache.org/httpclient-3.x/methods/multipartpost.html" target="_self"&gt;multipart post&lt;/A&gt; method to complete all upload tasks. You can optionally specify a &lt;CODE&gt;Content-MD5&lt;/CODE&gt; header with the &lt;A href="https://en.wikipedia.org/wiki/SHA-1" target="_self"&gt;SHA-1&lt;/A&gt; hash of the file to ensure that the file is not corrupted in transit.' 'Content-MD5' is just my part of playing options. With or without it, it doesn't make any difference. Below is the contents from log (unfortunately I don't have&amp;nbsp;&lt;SPAN&gt;SAS 9.4M5&lt;/SPAN&gt;, my SAS version is 9.4M4, but I will ask our IT to get M5 and use DEBUG once I have it):&lt;/P&gt;
&lt;P&gt;63 %put filesize=&amp;amp;filesize;&lt;/P&gt;
&lt;P&gt;filesize=5206757&lt;/P&gt;
&lt;P&gt;64&lt;/P&gt;
&lt;P&gt;65 *Submit the Upload request to Box ;&lt;/P&gt;
&lt;P&gt;66 proc http&lt;/P&gt;
&lt;P&gt;67 url="&lt;A href="https://upload.box.com/api/2.0/files/content" target="_blank"&gt;https://upload.box.com/api/2.0/files/content&lt;/A&gt;"&lt;/P&gt;
&lt;P&gt;68 method = "POST"&lt;/P&gt;
&lt;P&gt;69 out = resptext&lt;/P&gt;
&lt;P&gt;70 headerout = resphdrs&lt;/P&gt;
&lt;P&gt;71 in = request&lt;/P&gt;
&lt;P&gt;72 ct = "multipart/form-data; boundary=&amp;amp;boundary;Content-Length=&amp;amp;filesize"&lt;/P&gt;
&lt;P&gt;73 ;&lt;/P&gt;
&lt;P&gt;74 headers "Authorization" = "Bearer &amp;amp;my_token";&lt;/P&gt;
&lt;P&gt;75 run;&lt;/P&gt;
&lt;P&gt;NOTE: PROCEDURE HTTP used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 2.59 seconds&lt;/P&gt;
&lt;P&gt;cpu time 2.26 seconds&lt;/P&gt;
&lt;P&gt;NOTE: 400 Bad Request&lt;/P&gt;
&lt;P&gt;76&lt;/P&gt;
&lt;P&gt;77 /* Macro that simply echoes the contents of a fileref to the SAS log */&lt;/P&gt;
&lt;P&gt;78 %macro echofile(file);&lt;/P&gt;
&lt;P&gt;79 data _null_; infile &amp;amp;file; input; put _infile_; run;&lt;/P&gt;
&lt;P&gt;80 %mend;&lt;/P&gt;
&lt;P&gt;81 %echofile(resphdrs);&lt;/P&gt;
&lt;P&gt;NOTE: The infile RESPHDRS is:&lt;/P&gt;
&lt;P&gt;Filename=C:\Users\user\AppData\Local\Temp\SAS Temporary Files\_TD23544_DTOP90_\#LN00013,&lt;/P&gt;
&lt;P&gt;RECFM=V,LRECL=32767,File Size (bytes)=156,&lt;/P&gt;
&lt;P&gt;Last Modified=03Jan2018:13:32:47,&lt;/P&gt;
&lt;P&gt;Create Time=03Jan2018:13:32:47&lt;/P&gt;
&lt;P&gt;HTTP/1.1 400 Bad Request&lt;/P&gt;
&lt;P&gt;Date: Wed, 03 Jan 2018 18:32:45 GMT&lt;/P&gt;
&lt;P&gt;Content-Type: text/html; charset=UTF-8&lt;/P&gt;
&lt;P&gt;Content-Length: 0&lt;/P&gt;
&lt;P&gt;Age: 7&lt;/P&gt;
&lt;P&gt;Connection: keep-alive&lt;/P&gt;
&lt;P&gt;NOTE: 7 records were read from the infile RESPHDRS.&lt;/P&gt;
&lt;P&gt;The minimum record length was 0.&lt;/P&gt;
&lt;P&gt;The maximum record length was 38.&lt;/P&gt;
&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.01 seconds&lt;/P&gt;
&lt;P&gt;cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 18:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/424670#M68216</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-03T18:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/425241#M68258</link>
      <description>&lt;P&gt;Update: I have sas9.4 M5 installed. First I used 'debug level=1; the log has no difference comparing with without this statement; when I changed to 'level=2', SAS crashed as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17661i13F4F2FB33BFF8B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My SAS version:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 562px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17662iD4B659A4F8C0E43B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/425241#M68258</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-05T14:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/425243#M68259</link>
      <description>&lt;P&gt;below is the log when I am using 'debug level=1;':&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17663i54D68C3ECB51FDE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thanks for any thoguhts again!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/425243#M68259</guid>
      <dc:creator>HelenLondon</dc:creator>
      <dc:date>2018-01-05T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/508611#M72908</link>
      <description>&lt;P&gt;Hi - I have a similar problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also XLSX, DOCX, PDF files I would like to POST&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I have a CURL statement that works - but would very much like to convert it to PROC HTTP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So - Is this community-post solved?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 09:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/508611#M72908</guid>
      <dc:creator>jmic_nyk</dc:creator>
      <dc:date>2018-10-30T09:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/512150#M73094</link>
      <description>&lt;P&gt;As mentioned earlier I had a similar problem, this code works. The real problem was to detect how to build the Multipart form with the rigt bondary an content types. Feel free to copy.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I have the same problem in M5 when using "debug level=2" - SAS crashes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename req "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\request.txt";&lt;BR /&gt;filename resp "F:\SASNykredit\CURL_HTTP\HTTP trial\Datafiler\response.txt";&lt;BR /&gt;filename binfile "F:\SASNykredit\CURL-HTTP\HTTP trial\Datafiler\testdata.xlsx";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let _boundary=3fbd04f5-b1ed-4060-99b9-fca7ff59c113;&lt;BR /&gt;%let _cat=Testliste;&lt;BR /&gt;%let _publdate=%sysfunc(today(), yymmddd10.);&lt;BR /&gt;%let _unpubldate=%sysfunc(intnx(MONTH,%sysfunc(today(),8.),12,S),yymmddd10.);&lt;BR /&gt;%let _binname=%scan(%sysfunc(pathname(binfile)),-1,'\');&lt;BR /&gt;%let _title=%upcase(&amp;amp;sysuserid) TEST &amp;amp;_publdate.;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;=_boundary &amp;amp;=_cat &amp;amp;=_publdate &amp;amp;=_unpubldate &amp;amp;=_title &amp;amp;=_binname;&lt;/P&gt;
&lt;P&gt;/*** Fanger fejlkode fra PROC HTTP ***/&lt;BR /&gt;%macro prochttp_check_return(_exp_code);&lt;BR /&gt;%if %symexist(SYS_PROCHTTP_STATUS_CODE) ne 1 %then &lt;BR /&gt; %do;&lt;BR /&gt; %put ERROR: Expected &amp;amp;_exp_code., but a response was not received from the HTTP Procedure;&lt;BR /&gt; %end;&lt;BR /&gt;%else &lt;BR /&gt; %do;&lt;BR /&gt; %if &amp;amp;SYS_PROCHTTP_STATUS_CODE. ne &amp;amp;_exp_code. %then &lt;BR /&gt; %do;&lt;BR /&gt; %put ERROR: Expected &amp;amp;_exp_code., but received &amp;amp;SYS_PROCHTTP_STATUS_CODE.;&lt;BR /&gt; %put &amp;amp;SYS_PROCHTTP_STATUS_PHRASE.;&lt;BR /&gt; %end;&lt;BR /&gt; %else&lt;BR /&gt; %do;&lt;BR /&gt; %put NOTE: Alt i orden, forventet returkode: &amp;amp;SYS_PROCHTTP_STATUS_CODE. &amp;amp;SYS_PROCHTTP_STATUS_PHRASE.;&lt;BR /&gt; %end;&lt;BR /&gt; %end;&lt;BR /&gt;%mend prochttp_check_return;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/*** MULTIPART-FORM data ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req termstr=CRLF;&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="publish"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_publdate";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="unpublish"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_unpubldate";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="category"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_cat";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="title"';&lt;BR /&gt;put;&lt;BR /&gt;put "&amp;amp;_title";&lt;BR /&gt;put "--&amp;amp;_boundary.";&lt;BR /&gt;put 'Content-Disposition: form-data; name="uploadfile"; filename='"&amp;amp;_binname.";&lt;BR /&gt;put 'Content-Type: application/octet-stream';&lt;BR /&gt;put;&lt;BR /&gt;%_run(w);&lt;/P&gt;
&lt;P&gt;/*** Tilføjer binær fil ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req mod recfm=n;&lt;BR /&gt;infile binfile recfm=n;&lt;BR /&gt;input c $CHAR1.;&lt;BR /&gt;put c $CHAR1. @@;&lt;BR /&gt;%_run(w);&lt;/P&gt;
&lt;P&gt;/*** Afslutning ***/&lt;BR /&gt;data _null_;&lt;BR /&gt;file req mod termstr=CRLF;&lt;BR /&gt;put / "--&amp;amp;_boundary.--";&lt;BR /&gt;%_run(w);&lt;/P&gt;
&lt;P&gt;proc http&lt;BR /&gt; URL="&lt;A href="https://ptsv2.com/t/kommunikationsplatform/post" target="_blank"&gt;https://ptsv2.com/t/kommunikationsplatform/post&lt;/A&gt;"&lt;BR /&gt; METHOD="POST"&lt;BR /&gt; CT="multipart/form-data; boundary=&amp;amp;_boundary"&lt;BR /&gt; in=req&lt;BR /&gt; out=resp;&lt;BR /&gt; *DEBUG Level=1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;=sys_prochttp_status_code.;&lt;BR /&gt;%put &amp;amp;=sys_prochttp_status_phrase.;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%prochttp_check_return(200);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;filename req clear;&lt;BR /&gt;filename resp clear;&lt;BR /&gt;filename binfile clear;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 11:21:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/512150#M73094</guid>
      <dc:creator>jmic_nyk</dc:creator>
      <dc:date>2018-11-12T11:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: upload an excel file to box.com using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/553101#M74634</link>
      <description>&lt;P&gt;where do i get the value for macro variable&amp;nbsp;&lt;SPAN&gt;_boundary, or is it any constant &amp;nbsp;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for sharing your code&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 01:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/upload-an-excel-file-to-box-com-using-PROC-HTTP/m-p/553101#M74634</guid>
      <dc:creator>smijoss1</dc:creator>
      <dc:date>2019-04-23T01:08:04Z</dc:date>
    </item>
  </channel>
</rss>

