Minimalist C++ wrapper of easy (blocking interface) CURL library for RESTful communication.
More...
#include <curl_wrapper.h>
|
| CurlWrapper (std::string vccApiKey, std::string bearerToken) |
| Constructor. More...
|
|
bool | TryExecute (std::string url, std::string *response) |
| Try to execute a RESTful GET request. More...
|
|
Minimalist C++ wrapper of easy (blocking interface) CURL library for RESTful communication.
◆ CurlWrapper()
application::helper::CurlWrapper::CurlWrapper |
( |
std::string |
vccApiKey, |
|
|
std::string |
bearerToken |
|
) |
| |
Constructor.
- Parameters
-
vccApiKey | VCC API key |
bearerToken | OAuth 2.0 bearer token |
- Exceptions
-
std::runtime_error | Throws when the CURL handler creation failed. |
◆ TryExecute()
bool application::helper::CurlWrapper::TryExecute |
( |
std::string |
url, |
|
|
std::string * |
response |
|
) |
| |
Try to execute a RESTful GET request.
- Parameters
-
[in] | url | REST API request URL |
[out] | response | REST API server response in JSON format excluding the header |
- Returns
- True if the request is executed successfully (even with not 200 HTTP code); otherwise false
- Note
- In case of getting 'false' as the return value, the 'response' content should be discared.