Project

General

Profile

WebAPI

The WebAPI is designed to be lightweight and not drag a lot of external libraries, etc.
into your builds. It is pretty straightforward to use:

   #include "WebAPI.h" 
   #include <string>
   std::string line;

   try {
       WebAPI ds("http://www-css.fnal.gov/~mengel/Ascii_Chart.html");
       while(!ds.data().eof()) {
           getline(ds.data(), line);

           std::cout << "got line: " << line << std::endl;;
       }
   } catch (WebAPIException we) {
      std::cout << we.what() << std::endl;
   }

You construct it with the constructor which takes a URL parameter; and then
ds.data() returns an istream with which you can use getline(), etc.

If anything goes wrong, it will throw a WebAPIException containing any error
messages returned by the server, etc.

The constructor has two optional parameters, int postflag and std::string postdata,
for doing POST operations.

The current releases supports https: URLs by using the "openssl s_client" command
externally, and can use your grid proxy for x509 authentication when doing so.