<?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: How to post file using api. in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/374367#M1782</link>
    <description>&lt;P&gt;Nice! I solved as well, but using libcpr (a curl wrapper that is very easy to use)&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 16:53:06 GMT</pubDate>
    <dc:creator>BrunoValads</dc:creator>
    <dc:date>2024-01-09T16:53:06Z</dc:date>
    <item>
      <title>How to post file using api.</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/308178#M1778</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am trying to upload file as multipart/form-data using clientconnection. But it failed.&lt;/P&gt;
&lt;P&gt;This is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void ExportIFC::ExportData(const char* buffer, UINT32 size)
{
using namespace HTTP::Client;
using namespace HTTP::MessageHeader;
using namespace HTTP::Encoding;

IO::URI::URI connectionUrl(LINKURL);
ClientConnection clientConnection(connectionUrl);
clientConnection.Connect();
GS::UniString url = "/upload/" + this-&amp;gt;m_projectId + "/" + this-&amp;gt;m_uploadHandle;
Request postRequest(Method::Post, url);

RequestHeaderFieldCollection&amp;amp; headers = postRequest.GetRequestHeaderFieldCollection();
GS::UniString bearer = "bearer " + this-&amp;gt;m_token;
headers.Add(HeaderFieldName::Authorization, bearer);
headers.Add(HeaderFieldName::ContentType, "multipart/form-data");
headers.Add("Content-Disposition", "form-data; name=\"file\"; filename=\"test.ifc\"");

BodyOBinaryChannel&amp;amp; outChannel = clientConnection.BeginSend(postRequest);
outChannel.Write(buffer, size);

Response response;
clientConnection.Receive(response);
StatusCode::Id code = response.GetStatusCode();
if (code == StatusCode::OK)
{
 // post process
}
}

clientConnection.FinishReceive();
clientConnection.Close(false);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is my fault? Please help me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 18:46:03 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/308178#M1778</guid>
      <dc:creator>Chris Howell</dc:creator>
      <dc:date>2021-10-05T18:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to post file using api.</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/319798#M1779</link>
      <description>&lt;P&gt;Don't you need a &lt;STRONG&gt;clientConnection.FinishSend();&lt;/STRONG&gt; ?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 07:02:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/319798#M1779</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2021-11-05T07:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to post file using api.</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/371816#M1780</link>
      <description>&lt;P&gt;Hey! Was you able to achieve this? I'm trying it too, with&amp;nbsp;&lt;STRONG&gt;clientConnection.FinishSend()&lt;/STRONG&gt;, but I'm getting some errors from the server, maybe due how I'm writing. Shouldn't boundaries be written?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 21:26:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/371816#M1780</guid>
      <dc:creator>BrunoValads</dc:creator>
      <dc:date>2023-02-28T21:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to post file using api.</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/373913#M1781</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I could not to upload the file with clientconnection.&lt;BR /&gt;So I solved the problem using cURL.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 22:49:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/373913#M1781</guid>
      <dc:creator>Chris Howell</dc:creator>
      <dc:date>2023-03-21T22:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to post file using api.</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/374367#M1782</link>
      <description>&lt;P&gt;Nice! I solved as well, but using libcpr (a curl wrapper that is very easy to use)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 16:53:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-post-file-using-api/m-p/374367#M1782</guid>
      <dc:creator>BrunoValads</dc:creator>
      <dc:date>2024-01-09T16:53:06Z</dc:date>
    </item>
  </channel>
</rss>

