Skip to main content

C++ Client

ApertureDB server supports a JSON-based query language described in this documentation. Our recommended interface language is Python, but we do have a lightweight C++ client library. The C++ client library is available in this repository: aperture-data/aperturedb-cp. It makes it easy for the user to send and receive the JSON files and binary data to an ApertureDB instance.

Here is an outline of how to create a connection and send a query:

Header file

First include the header file:

#include "aperturedb/VDMSClient.h"

Create client configuration

The VDMSClientConfig class represents a configuration to access a specific ApertureDB host:

VDMSClientConfig(
std::string addr_ = "localhost",
int port_ = VDMS_PORT,
Protocol protocols_ = Protocol::Any,
std::string ca_certificate_ = "",
comm::ConnMetrics* metrics_ = nullptr)

For example:

VDMS::VDMSClientConfig config = VDMS::VDMSClientConfig("localhost", 55555);

Create a client object

The VDMSClient object represents a connection using a username, password, and configuration:

VDMSClient(
std::string username,
std::string password,
const VDMSClientConfig& config = {});

For example:

VDMSClient client = VDMSClient("admin", "mysecret", config);

Run a query

Use the query method on VDMSClient to run a query. Supply the JSON query string (see ApertureDB Query Language) and optionally a vector of binary blobs.

VDMS::Response VDMSClient::query(
const std::string& json,
const std::vector< std::string* > blobs={});

For example:

VDMS::Response response = client.query(query);

Use the response

The response object contains a JSON response string (see Responses) and a vector of zero or more binary blobs.

struct Response {
std::string json{};
std::vector< std::string > blobs{};
};

Deploying Your Own Application

Once ApertureDB server and client are ready and you are ready to define your application:

  1. You can define your application schema,
  2. Ingest data, and
  3. Start querying and visualizing data.