create a RESTful web service sample

May 1, 2015 at 7:41 PM
I was looking through the samples provided with the SDK, but couldn't find any as to how to create a RESTful service. So, can anyone guide me where I can find some samples to get started in creating a service using C++ REST SDK.
Thanks in advance.. :)
Coordinator
May 1, 2015 at 7:44 PM

Hi RakiHexCode,

The C++ REST SDK is really focused on connecting to REST services, not so much on authoring them. We have a http_listener class which can be used to create a primitive HTTP server.

For more information on the http_listener take a look at:

· reference documentation

· CasaLen http_listener sample

· BlackJack server sample

Steve

May 2, 2015 at 5:14 AM
Thanks for your reply Steve
May 3, 2015 at 4:50 PM
Hi Steve,

Thanks for pointing me in right direction. I could get an http server up and running. But I couldn't figure out how I can extract parameters out of my http_request object, for both GET and POST requests... ?

The only way I see that this can be done is by string parsing of the entire message, which is quite costly. Please guide me again..

RaKi
Coordinator
May 4, 2015 at 3:13 PM
Hi RaKi,

On the http_request object you can access the request URI via the http_request::request_uri method. This returns an web::uri object. From which you can access the query component of the URI and use a method like uri::split_query to break down all the parameters.

Steve