Skip to content

RestService is a modern cross-platform RESTful library!

License

Notifications You must be signed in to change notification settings

TheCompez/RestService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RestService is a modern cross-platform RESTful library

Note : This library is not yet complete and conceptually under development.

forthebadge

Total alerts Language grade: C/C++ Language iso: C++ Version Platform Dependencies

Installation

First of all, You need to make sure that curl library is installed on your development environment. So it may have some problems!

Building

  • You need CMake tool for building source code
  • Get Curl & RapidJson [Pay Attention: RapidJson is header only]
  • All source code is written with Pure STL 1z (C++17)
  • MSVC 2017, GCC8.x or Clang 9.x
  • Add RestService.dll [on Windows], libRestService.dylib [on macOS] or libRestService.so [on Linux] for your project as external library. you can compile it by static mode.
  • Import SDK common header #include <RestService>

Note: In order to build the create, your compiler must support C++17 features.

Building extra option in CMake

cmake .. -DENABLE_SAFE_ONLY=true 
cmake .. -DENABLE_SAFTY_MODE=true 

Usage Example

#include <iostream>
#include <RestService>

int main()
{
    auto request = RestService::NetworkRequest();

    //!GET Method
    {
        request.get("http://dummy.restapiexample.com/api/v1/employees");
        auto result = request.getResult();
        std::cout << "Result Get: " << result << std::endl;
    }

    //!POST Method
    {
        request.post("https://jsonplaceholder.typicode.com/comments?", "postId=1");
        auto result = request.getResult();
        std::cout << "Result Post : " << result << std::endl;
    }

    return 0;
}

Contribution

Bug fixes, docs, and enhancements welcome! Please let me know [email protected]

ToDo

  • More Exception handling.
  • Add Logger for any states.
  • And more features...