The `Get()` method is nothing but a shortcut of `Request()`. Using `Request()` directly is more complicated:
```cpp
auto r = session.Request(webcc::HttpRequestBuilder{}.Get().
Url("http://httpbin.org/get")
());
```
As you can see, a helper class named `HttpRequestBuilder` is used to chain the parameters and finally build (don't miss the `()` operator) a request object.
Both the shortcut and `Request()` accept URL query parameters:
```cpp
// Query parameters are passed using a std::vector.
*NOTE: The HTTPS/SSL support requires the build option `WEBCC_ENABLE_SSL` to be enabled.*
For more examples, see the Wiki tutorials.
Listing GitHub public events is not a big deal:
```cpp
auto r = session.Get("https://api.github.com/events");
```
You can then parse `r->content()` to JSON object with your favorite JSON library. My choice for the examples is [jsoncpp](https://github.com/open-source-parsers/jsoncpp). But the library itself doesn't understand JSON nor require one. It's up to you to choose the most appropriate JSON library.
## Build Instructions
@ -52,34 +90,36 @@ For more examples, see the Wiki tutorials.
A lot of C++11 features are used, e.g., `std::move`.
VS2015 and above is required for building `webcc` on Windows. No support for VS2013 any more!
VS2013 and above is required for building `webcc` on Windows.
[CMake 3.1.0+](https://cmake.org/) is used as the build system. But if you don't use CMake, you can just copy the `src/webcc` folder to your own project then manage it by yourself, though some changes are needed to make it work. See [Wiki/Integrate Into Your Project]( https://github.com/sprinfall/webcc/wiki/Integrate-Into-Your-Project) for more details.
[C++ Boost](https://www.boost.org/) should be 1.66+ because Asio made some broken changes to the API since 1.66.
OpenSSL is required for HTTPS support. Already included in the `third_party` folder for Windows.
OpenSSL is required for HTTPS support. See `WEBCC_ENABLE_SSL` option.
Zlib is required for compressing and decompressing HTTP requests and responses.
Zlib is required for compressing and decompressing HTTP requests and responses. Already included in the `third_party` folder for Windows.
### Build Options
The following CMake options determine how you build the projects. They are quite self-explanatory.
```cmake
option(WEBCC_ENABLE_SOAP "Enable SOAP support (need pugixml)?" ON)
option(WEBCC_ENABLE_TEST "Build test?" ON)
option(WEBCC_ENABLE_UNITTEST "Build unit test?" ON)
Options `WEBCC_ENABLE_LOG` and `WEBCC_LOG_LEVEL` together define how logging behaves. See [Wiki/Logging](https://github.com/sprinfall/webcc/wiki/Logging) for more details.
If `WEBCC_ENABLE_SOAP` is `1`, **pugixml** (already included) is used to parse and compose XML strings.
You should install OpenSSL development files before try to enable `WEBCC_ENABLE_SSL`.
### Build On Linux
### Build on Linux
Create a build folder under the root (or any other) directory, and `cd` to it: