AOSharedServiceLibrary
|
The HTTP Admin allows quick and easy HTTP Requests by exposing:
We start by importing the necessary interfaces and establish the service factory.
#include "aossl/http/client/factory_http_client.h" #include "aossl/http/client/http_interface.h" HttpClientFactory http_client_factory; //Declare the admin HttpInterface *ha = http_client_factory.get_http_interface();
Send a get request:
std::string returned_string = ha->get(GETURL, 5);
Send a put request:
bool success = ha->put(PUTURL, "123", 5);
Send a post request:
success = ha->post(POSTURL, "CLYMAN", 5);
Send a delete request:
success = ha->del(DELETEURL, 5);
The HTTP Admin has a mutex around the internal send() method, called by all exposed API methods. This means that the HTTP Administrator is thread-safe, but only one message will be sent at a time.