<?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 to cloud works, but fails on local server in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6547#M569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Moving this to the &lt;A href="https://community.checkpoint.com/space/2063"&gt;SandBlast API&lt;/A&gt;‌ space and tagging &lt;A href="https://community.checkpoint.com/migrated-users/46568"&gt;Matan Mishan&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you show the exact API call (and response) you received when you queried the&amp;nbsp;local appliance?&lt;/P&gt;&lt;P&gt;(Obscure the API key, of course)&lt;/P&gt;&lt;P&gt;We do have the&amp;nbsp;&lt;A href="https://community.checkpoint.com/docs/DOC-2109"&gt;SandBlast API documentation&lt;/A&gt;‌ that might also be helpful as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Sep 2017 15:43:12 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2017-09-26T15:43:12Z</dc:date>
    <item>
      <title>Upload to cloud works, but fails on local server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6546#M568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am trying to communicate with the Thread Prevention API using a C# client. Got a test API key for the cloud, but in the end, I want to use our local system. On the cloud everythin works fine. But on the local system, the upload fails:&amp;nbsp;code:1008,label:BAD_REQUEST, message: Invalid Multipart/form request. I compared the requests using fiddler, they seem to be the same. Something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;POST &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://te.checkpoint.com/tecloud/api/v1/file/upload" rel="nofollow"&gt;https://te.checkpoint.com/tecloud/api/v1/file/upload&lt;/A&gt;&lt;SPAN&gt; HTTP/1.1&lt;/SPAN&gt;&lt;BR /&gt;Authorization: TE_API_KEY_n7xxxxxxxxxxxxxxxxxxxxxxxxxxxuP&lt;BR /&gt;Content-Type: multipart/form-data; boundary="Upload----09/26/2017 10:31:22"&lt;BR /&gt;Host: te.checkpoint.com&lt;BR /&gt;Cookie: te_cookie=AOPHKIXA&lt;BR /&gt;Content-Length: 23060&lt;BR /&gt;Expect: 100-continue&lt;/P&gt;&lt;P&gt;--Upload----09/26/2017 10:31:22&lt;BR /&gt;Content-Type: text/plain; charset=utf-8&lt;BR /&gt;Content-Disposition: form-data; name=request&lt;/P&gt;&lt;P&gt;{"request":{"extraction":{"scrubbed_parts_codes":null,"method":null},"file_type":"pdf","file_name":"Test.pdf","te":{"images":null,"reports":[]},"features":["te"],"sha1":"314e2eda1b4d26c060ec49c0db11ce1eefc8ee55"}}&lt;BR /&gt;--Upload----09/26/2017 10:31:22&lt;BR /&gt;Content-Disposition: form-data; name=file; filename=Test.pdf; filename*=utf-8''Test.pdf&lt;/P&gt;&lt;P&gt;%PDF-1.5 .......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The C# upload code sniplet looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using (var formData = new MultipartFormDataContent("Upload----1234567457645"))&lt;BR /&gt; {&lt;BR /&gt; formData.Add(stringContent, "request");&lt;BR /&gt; formData.Add(fileStreamContent, "file");&lt;BR /&gt; var response = client.PostAsync(new Uri(TE_API_URL + UPLOAD_PATH), formData).Result;&lt;BR /&gt; if (response.IsSuccessStatusCode)&lt;BR /&gt; {&lt;BR /&gt; return await response.Content.ReadAsStringAsync(); &lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have an idea what is going wrong locally?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2017 09:48:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6546#M568</guid>
      <dc:creator>Christof_Marte</dc:creator>
      <dc:date>2017-09-26T09:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Upload to cloud works, but fails on local server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6547#M569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Moving this to the &lt;A href="https://community.checkpoint.com/space/2063"&gt;SandBlast API&lt;/A&gt;‌ space and tagging &lt;A href="https://community.checkpoint.com/migrated-users/46568"&gt;Matan Mishan&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you show the exact API call (and response) you received when you queried the&amp;nbsp;local appliance?&lt;/P&gt;&lt;P&gt;(Obscure the API key, of course)&lt;/P&gt;&lt;P&gt;We do have the&amp;nbsp;&lt;A href="https://community.checkpoint.com/docs/DOC-2109"&gt;SandBlast API documentation&lt;/A&gt;‌ that might also be helpful as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2017 15:43:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6547#M569</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2017-09-26T15:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Upload to cloud works, but fails on local server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6548#M570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dameon,&lt;/P&gt;&lt;P&gt;thank you for your help. These are the local appliance calls:&lt;/P&gt;&lt;P&gt;First, a request to check if the file exists (in this case, I use the eicar test string):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN&gt;POST &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://xx.x.x.xxx:18194/tecloud/api/v1/file/query" rel="nofollow"&gt;https://xx.x.x.xxx:18194/tecloud/api/v1/file/query&lt;/A&gt;&lt;SPAN&gt; HTTP/1.1&lt;/SPAN&gt;&lt;BR /&gt;Content-Type: application/json; charset=utf-8&lt;BR /&gt;Host: 10.1.0.239:18194&lt;BR /&gt;Content-Length: 215&lt;BR /&gt;Expect: 100-continue&lt;BR /&gt;Connection: Keep-Alive&lt;/P&gt;&lt;P&gt;{"request":{"extraction":{"scrubbed_parts_codes":null,"method":null},"file_type":"type","file_name":"EICAR.txt","te":{"images":null,"reports":[]},"features":["te"],"sha1":"3395856ce81f2b7382dee72602f798b642f14140"}}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The response is as expected, and it shows that the communication with the local appliance works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;HTTP/1.0 200 OK&lt;BR /&gt;Date: Wed, 27 Sep 2017 06:32:28 GMT&lt;BR /&gt;Server: Check Point SVN foundation&lt;BR /&gt;Content-Type: text/html&lt;BR /&gt;X-UA-Compatible: IE=EmulateIE7&lt;BR /&gt;Connection: Keep-Alive&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;Content-Length: 1093&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "response" : {&lt;BR /&gt; "features" : [ "te" ],&lt;BR /&gt; "file_name" : "EICAR.txt",&lt;BR /&gt; "file_type" : "type",&lt;BR /&gt; "md5" : "",&lt;BR /&gt; "sha1" : "3395856ce81f2b7382dee72602f798b642f14140",&lt;BR /&gt; "sha256" : "",&lt;BR /&gt; "status" : {&lt;BR /&gt; "code" : 1004,&lt;BR /&gt; "label" : "NOT_FOUND",&lt;BR /&gt; "message" : "Couldn't find the requested file, please upload it"&lt;BR /&gt; },&lt;BR /&gt; "te" : {&lt;BR /&gt; "images" : [&lt;BR /&gt; {&lt;BR /&gt; "id" : "5e5de275-a103-4f67-b55b-47532918fa59",&lt;BR /&gt; "report" : {&lt;BR /&gt; "verdict" : "unknown"&lt;BR /&gt; },&lt;BR /&gt; "revision" : 1,&lt;BR /&gt; "status" : "not_found"&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; "id" : "e50e99f3-5963-4573-af9e-e3f4750b55e2",&lt;BR /&gt; "report" : {&lt;BR /&gt; "verdict" : "unknown"&lt;BR /&gt; },&lt;BR /&gt; "revision" : 1,&lt;BR /&gt; "status" : "not_found"&lt;BR /&gt; }&lt;BR /&gt; ],&lt;BR /&gt; "status" : {&lt;BR /&gt; "code" : 1004,&lt;BR /&gt; "label" : "NOT_FOUND",&lt;BR /&gt; "message" : "Couldn't find the requested file, please upload it"&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The file is not known to the application, so I try to upload:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN&gt;POST &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://xx.x.x.xxx:18194/tecloud/api/v1/file/upload" rel="nofollow"&gt;https://xx.x.x.xxx:18194/tecloud/api/v1/file/upload&lt;/A&gt;&lt;SPAN&gt; HTTP/1.1&lt;/SPAN&gt;&lt;BR /&gt;Content-Type: multipart/form-data; boundary="Upload----1234567457645"&lt;BR /&gt;Host: 10.1.0.239:18194&lt;BR /&gt;Content-Length: 503&lt;BR /&gt;Expect: 100-continue&lt;BR /&gt;Connection: Keep-Alive&lt;/P&gt;&lt;P&gt;--Upload----1234567457645&lt;BR /&gt;Content-Type: text/plain; charset=utf-8&lt;BR /&gt;Content-Disposition: form-data; name=request&lt;/P&gt;&lt;P&gt;{"request":{"extraction":{"scrubbed_parts_codes":null,"method":null},"file_type":"pdf","file_name":"EICAR.txt","te":{"images":null,"reports":null},"features":null,"sha1":"3395856ce81f2b7382dee72602f798b642f14140"}}&lt;BR /&gt;--Upload----1234567457645&lt;BR /&gt;Content-Disposition: form-data; name=file&lt;/P&gt;&lt;P&gt;X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*&lt;BR /&gt;--Upload----1234567457645--&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This upload request uses the multipart-format and is generated by the C# code shown in&amp;nbsp;the question. The response gives an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;HTTP/1.0 200 OK&lt;BR /&gt;Date: Wed, 27 Sep 2017 06:32:30 GMT&lt;BR /&gt;Server: Check Point SVN foundation&lt;BR /&gt;Content-Type: text/html&lt;BR /&gt;X-UA-Compatible: IE=EmulateIE7&lt;BR /&gt;Connection: Keep-Alive&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;Content-Length: 197&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "response" : [&lt;BR /&gt; {&lt;BR /&gt; "status" : {&lt;BR /&gt; "code" : 1008,&lt;BR /&gt; "label" : "BAD_REQUEST",&lt;BR /&gt; "message" : "Invalid Multipart/form request"&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; ]&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Using the cloud host&amp;nbsp;te.checkpoint.com, the upload works. There the results are "UPLOAD_SUCCESS". The only difference I see in the cloud (besides using the API key there, of course) is the te_cookie used in the session there.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 06:54:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6548#M570</guid>
      <dc:creator>Christof_Marte</dc:creator>
      <dc:date>2017-09-27T06:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Upload to cloud works, but fails on local server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6549#M571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Christof, if you are using the same routine for doing the request for both cloud and local apliance then you might be sending the te_cookie to the local appliance, this causes an error because TP API does not provide a cookie therefore it will not understand why you are sending it.&amp;nbsp; If you want to use the same routine, add a load balancer in the middle and insert te_cookie, you can choose whatever you want as a cookie, you will need to do this if you want an application to send files to a Private Cloud ( and mantain persistency ) and not just to a single appliance. So try removing the cookie and also the Authorization Headers, you don't need them for local emulation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Oct 2017 04:04:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Upload-to-cloud-works-but-fails-on-local-server/m-p/6549#M571</guid>
      <dc:creator>Javier_Padilla</dc:creator>
      <dc:date>2017-10-01T04:04:45Z</dc:date>
    </item>
  </channel>
</rss>

