Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
Developer forum

HTTP Request



I need to make a HTTP request with the GET method, in this form:

Request prepared as:

request = GS::StaticCast<Communication::Client::Http::HttpClientRequest> (clientConnection->CreateRequest ());

There was some example which takes the requestMethod (not 'GET' or 'POST' but some path like "/api/ip") and a requestMethodId in the form of "some-text-with-hyphens"

request->SetRequestLine (Communication::Http::RequestLine (request->GetRequestLine ().GetProtocolVersion (), "GET", request->GetRequestLine ().GetUri () + requestMethod));
request->SetId (requestMethodId);


Is this example made just for accessing a specific API? I could not figure out what that requestMethodId would be in generic cases.

Can someone please tell how to make a generic HTTP request using class COMMUNICATIONCLIENT_API ClientRequest ?



Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni



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.

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 😉


I see that you will have to pass parameters also. Use the AddParameter function of the request to define the parameters.

Hi Tibor,

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.

The try-catch is returning an ExceptionError ('The server failed to fulfil the request').

I added the parameters as:


and also tried:


both before and after request->SetRequestLine(). I'm getting the same exception-error.

After adding the parameters to 'request', I checked the parameter count:

request->GetParameterCount(), it returns the correct number of parameters added.


What could be going wrong? Is there a way to get the exact error-message received in the response?



Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!