<?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: HTTP Request in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306725#M1752</link>
    <description>&lt;P&gt;Hi Tibor,&lt;/P&gt;&lt;P&gt;I removed the SetId() function and passed the requestMethod as the part-URL (removing the base URL), and also passed the parameters of type Communication::Parameter.&lt;/P&gt;&lt;P&gt;The try-catch is returning an ExceptionError ('The server failed to fulfil the request').&lt;/P&gt;&lt;P&gt;I added the parameters as:&lt;/P&gt;&lt;P&gt;request-&amp;gt;AddParameter(param)&lt;/P&gt;&lt;P&gt;and also tried:&lt;/P&gt;&lt;P&gt;request-&amp;gt;SetParameter(param)&lt;/P&gt;&lt;P&gt;both before and after request-&amp;gt;SetRequestLine(). I'm getting the same exception-error.&lt;/P&gt;&lt;P&gt;After adding the parameters to 'request', I checked the parameter count:&lt;/P&gt;&lt;P&gt;request-&amp;gt;GetParameterCount(), it returns the correct number of parameters added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be going wrong? Is there a way to get the exact error-message received in the response?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Sep 2021 17:19:01 GMT</pubDate>
    <dc:creator>dushyant</dc:creator>
    <dc:date>2021-09-20T17:19:01Z</dc:date>
    <item>
      <title>HTTP Request</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306664#M1750</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I need to make a HTTP request with the GET method, in this form:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://someurl.com/api/somecode?param1=val1&amp;amp;param2=val2&lt;/LI-CODE&gt;&lt;P&gt;Request prepared as:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;request = GS::StaticCast&amp;lt;Communication::Client::Http::HttpClientRequest&amp;gt; (clientConnection-&amp;gt;CreateRequest ());&lt;/LI-CODE&gt;&lt;P&gt;There was some example which takes the &lt;STRONG&gt;requestMethod&lt;/STRONG&gt; (not 'GET' or 'POST' but some path like "&lt;STRONG&gt;/api/ip&lt;/STRONG&gt;") and a &lt;STRONG&gt;requestMethodId&lt;/STRONG&gt; in the form of "&lt;STRONG&gt;some-text-with-hyphens&lt;/STRONG&gt;"&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;request-&amp;gt;SetRequestLine (Communication::Http::RequestLine (request-&amp;gt;GetRequestLine ().GetProtocolVersion (), "GET", request-&amp;gt;GetRequestLine ().GetUri () + requestMethod));
request-&amp;gt;SetId (requestMethodId);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this example made just for accessing a specific API? I could not figure out what that requestMethodId would be in generic cases.&lt;/P&gt;&lt;P&gt;Can someone please tell how to make a generic HTTP request using class COMMUNICATIONCLIENT_API ClientRequest ?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 09:44:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306664#M1750</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2021-09-20T09:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Request</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306717#M1751</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The CommunicationClient_Test Exmple Add-On shows a simple example for using REST API, but the example can work for any other REST APIs with minimal modifications.&lt;/P&gt;
&lt;P&gt;It's not required to use the SetId function. That depends on the server side implementation. That could be for example a session identifier or an identifier of various REST API methods. So if the used service does not require any id, then simply don't care about requestMethodId &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you will have to pass parameters also. Use the&amp;nbsp;&lt;STRONG&gt;AddParameter&lt;/STRONG&gt; function of the request to define the parameters.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 15:58:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306717#M1751</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2021-09-20T15:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Request</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306725#M1752</link>
      <description>&lt;P&gt;Hi Tibor,&lt;/P&gt;&lt;P&gt;I removed the SetId() function and passed the requestMethod as the part-URL (removing the base URL), and also passed the parameters of type Communication::Parameter.&lt;/P&gt;&lt;P&gt;The try-catch is returning an ExceptionError ('The server failed to fulfil the request').&lt;/P&gt;&lt;P&gt;I added the parameters as:&lt;/P&gt;&lt;P&gt;request-&amp;gt;AddParameter(param)&lt;/P&gt;&lt;P&gt;and also tried:&lt;/P&gt;&lt;P&gt;request-&amp;gt;SetParameter(param)&lt;/P&gt;&lt;P&gt;both before and after request-&amp;gt;SetRequestLine(). I'm getting the same exception-error.&lt;/P&gt;&lt;P&gt;After adding the parameters to 'request', I checked the parameter count:&lt;/P&gt;&lt;P&gt;request-&amp;gt;GetParameterCount(), it returns the correct number of parameters added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be going wrong? Is there a way to get the exact error-message received in the response?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 17:19:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/HTTP-Request/m-p/306725#M1752</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2021-09-20T17:19:01Z</dc:date>
    </item>
  </channel>
</rss>

