Build Status

Restless

Restless is a simple REST client for C++, powered by curl.

Integration

You can use your project's existing build system to compile all the files in src directory and link to your project.

To use this all you need to do is add

#include <restless.hpp>

// for a more readable name
using Http = asoni::Handle;

Examples


/*
 * A simple get request
 **/

auto res1 = Http().get("http://httpbin.org/get")
            .exec();

/*
 * A get request with basic auth and a custom header
 **/

auto res2 = Http().get("http://httpbin.org/get", "password-for-basic-auth")
            .header({{"Hello", "This is a header"}, {"Second","Another header"}})
            .exec();

/*
 * A post request with basic auth
 **/
auto post1 = Http().post("http://httpbin.org/post", "super-secret-password")
                    .content("text/plain", "Hello world")
                    .exec();

/*
 * A simple put request
 **/

auto put1 = Http().put("http://httpbin.org/put")
            .content("text/plain", "Hello world")
            .exec();

/*
 * A simple delete request
 **/

auto del = Http().del("http://httpbin.org/delete")
           .exec();

Dependencies

Note: A vagrant file has been provided that will provision a Ubuntu14.04 box with all the pre-requisites. Just vagrant up then vagrant ssh. You will find the code in /vagrant directory inside the vagrant box.

Steps to build

Contribute