Rest Class Reference
A helper class for making REST requests. More...
#include <RestClient.hh>
Public Member Functions | |
Rest ()=default | |
Default constructor. More... | |
virtual RestResponse | Request (const HttpMethod _method, const std::string &_url, const std::string &_version, const std::string &_path, const std::vector< std::string > &_queryStrings, const std::vector< std::string > &_headers, const std::string &_data, const std::multimap< std::string, std::string > &_form=std::multimap< std::string, std::string >()) const |
Trigger a REST request. More... | |
void | SetUserAgent (const std::string &_agent) |
Set the user agent name. More... | |
const std::string & | UserAgent () const |
Get the user agent name. More... | |
Detailed Description
A helper class for making REST requests.
Constructor & Destructor Documentation
◆ Rest()
|
default |
Default constructor.
Member Function Documentation
◆ Request()
|
virtual |
Trigger a REST request.
- Parameters
-
[in] _method The HTTP method. Use all uppercase letters. E.g.: "GET" [in] _url The url to request. E.g.: "http://localhost:8000/" [in] _version The protocol version. E.g.: "1.0" [in] _path The path to request. E.g.: "collection" [in] _queryStrings All the query strings to be requested. E.g.: {"sort=name", "sortdir=1"} [in] _headers All the headers to be included in the HTTP request E.g.: {"Accept: application/json"} [in] _data Data to be included in the HTTP request. [in] _form Multi-part / form data to be used with Method::POST_FORM. Files can be transferred by using a value of "@<local_file_path>;<upload_filename>". For example, to transfer the local file "/tmp/test.txt" and upload the file as "changed.txt" in a form with the field name "file", then insert the following key-value pair into the _form parameter: {"file", "@/tmp/test.txt;changed.txt"}
. The ";<upload_filename>" portion is optional. If this part is absent, then the basename of provided "<local_file_path>" is used. For example, "@/tmp/text.txt" will be uploaded as "text.txt".
◆ SetUserAgent()
void SetUserAgent | ( | const std::string & | _agent | ) |
Set the user agent name.
- Parameters
-
[in] _agent User agent name.
◆ UserAgent()
const std::string& UserAgent | ( | ) | const |
Get the user agent name.
- Returns
- Name of the user agent.
The documentation for this class was generated from the following file: