New C++ wrapper for MarkLogic’s REST API…

I’ve been at it again! My third language REST wrapper! Read on for more details…

MarkLogic, my employer, have been on a streak with expanding developer support by creating REST wrappers for the most common languages.

MarkLogic already has a Java API, which is now developed in the open on GitHub, and a official JavaScript wrapper (inspired by my very own MLJS!) for Node.js on the way. (Not to mention server side JavaScript!)

I’ve previously also created a .NET one for my own purposes, but recently I’ve been asked a lot about creating a C++ wrapper!

C++ isn’t fashionable for the web 2.0 crowd, or for middle tier coding, but it’s still a massive force in our industry.

Maybe not today, maybe not tomorrow, but some day

Although not commonly used as a REST client, things have gotten interesting lately with C++11 and Microsoft’s new Open Source (Yes! Microsoft releasing an Apache 2 licensed product in the open!) C++ based REST wrapper API called Casablanca.

Oh, and Casablanca is multi platform! It supports *nix, Linux, Mac OS X, Windows, Windows Mobile and even iOS. It also provides a very neat and effective callback mechanism that makes using REST services in C++ a breeze.

Casablanca was released initially at the end of 2013, but I’d say is mature as of April 2014. All the basic docs are there now, and it uses CMake for a standard build platform, which makes it easy to build on all platforms.

It’s going to make our job much easier writing a C++ REST wrapper… I say ‘our’ job, but to be honest the last serious C++ application I built in anger was in 1998!

Hours of projects for MarkLogic¬†customers’ benefit

Thankfully, MarkLogic gives 20 hours of time to it’s consultants each quarter to work on projects of use to our customers. This forms part of their quarterly bonus!

One of MarkLogic’s consultants, Paul Hoehne, last quarter worked on adding Bower support to my MLJS JavaScript wrapper. This quarter he’s all psyched up to work on the first code for our C++ wrapper API!

I’ve made sure he’s got something to work with. I shelled out (literally) the repository on GitHub. Added a CMake config, placeholder C++ cpp and header files, and created a whole bunch of scripts to generate project files/makefiles for Linux, *nix, Mac XCode, KDevelop3, Eclipse CDT, and Windows Visual Studio.

I’ve even added CPack installer support and Doxygen documentation generation!

When can you use it?

Paul’s busy beavering away, so I have no doubt you can just watch the repo over the next couple of weeks and there’ll be a working version, although basic.

We have things like authentication and connection handling to sort out (so C++ developers don’t have to!), and then creation of each REST call in turn. We’ll try and keep the interface similar to existing drivers so it’s easy to convert if you already know one.

Why use it?

I’ve seen three app requirements this year that need to access MarkLogic from C++. These are for platform integration and application integration.

These efforts will be significantly sped up if a single, well tested C++ wrapper API is created. This is why we’re working on it.

By the end of July 2014 we should have something ready for use. In the meantime, request your favourite features in the issues area of GitHub, or even better fork the repo and contribute your own code too!

We hope you enjoy it!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.