The PIWebAPI class.
More...
#include <piwebapi.h>
|
void | setAuthMethod (std::string &authMethod) |
|
void | setAuthBasicCredentials (std::string &authBasicCredentials) |
|
int | GetVersion (const string &host, string &version, bool logMessage=true) |
| Calls the PI Web API to retrieve the version. More...
|
|
string | ExtractVersion (const string &response) |
| Extracts the PIWebAPI version from the JSON returned by the PIWebAPI api. More...
|
|
string | errorMessageHandler (const string &msg) |
| Handles PI Web API error message considering the possible cases: More...
|
|
◆ errorMessageHandler()
string PIWebAPI::errorMessageHandler |
( |
const string & |
msg | ) |
|
Handles PI Web API error message considering the possible cases:
- removes all the LF CR and extracts spaces
- substitutes a message with a different one using an hardcoded vector
- in the case of the presence of an HTTP code adds the corresponding text using the Simple-Web-Server functionalities
- Handles PI Web API json error message extracting significant parts to produce a meaningful and concise message
- Parameters
-
json | JSON message generated by PIWebAPI containing the error |
- Returns
- The concise and meaningful error message
◆ ExtractVersion()
std::string PIWebAPI::ExtractVersion |
( |
const string & |
response | ) |
|
Extracts the PIWebAPI version from the JSON returned by the PIWebAPI api.
- Parameters
-
response | JSON message generated by the PIWebAPI API containing the version |
- Returns
- The version of the PIWebAPI server
◆ GetVersion()
int PIWebAPI::GetVersion |
( |
const string & |
host, |
|
|
string & |
version, |
|
|
bool |
logMessage = true |
|
) |
| |
Calls the PI Web API to retrieve the version.
- Parameters
-
host | Reference of the server running PI Web API in the format: hostName + ":" + port |
version | The returned version string of the PI Web API server |
logMessage | If true, log an error message if there is a failure (default: true) |
- Returns
- HTTP response status code
The documentation for this class was generated from the following files:
- C/plugins/common/include/piwebapi.h
- C/plugins/common/piwebapi.cpp