RestApi Class Reference

REST interface. More...

#include <RestApi.hh>

Public Member Functions

 RestApi ()
 Constructor. More...
 
virtual ~RestApi ()
 Destructor. More...
 
std::string GetUser () const
 Returns the username. More...
 
std::string Login (const std::string &_url, const std::string &_route, const std::string &_user, const std::string &_pass)
 Connects to the REST service. More...
 
void Logout ()
 Stops sending messages to the REST service. More...
 
void PostJsonData (const char *_route, const char *_json)
 Notify the service with a http POST. More...
 

Detailed Description

REST interface.

Constructor & Destructor Documentation

◆ RestApi()

RestApi ( )

Constructor.

◆ ~RestApi()

virtual ~RestApi ( )
virtual

Destructor.

Member Function Documentation

◆ GetUser()

std::string GetUser ( ) const

Returns the username.

Returns
The user name

◆ Login()

std::string Login ( const std::string &  _url,
const std::string &  _route,
const std::string &  _user,
const std::string &  _pass 
)

Connects to the REST service.

Parameters
[in]_urlThe web service url
[in]_routeThe route on the server
[in]_userThe user name
[in]_passThe user password
Returns
The response message from the REST server

◆ Logout()

void Logout ( )

Stops sending messages to the REST service.

Does not do anything if not logged in. Once logged out, a new call to Login has to be made to resume sending messages.

◆ PostJsonData()

void PostJsonData ( const char *  _route,
const char *  _json 
)

Notify the service with a http POST.

Parameters
[in]_routeon the web server
[in]_jsonthe data to send to the server

The documentation for this class was generated from the following file: