Skip to content

First request with C++

List your own copiers to check connectivity and identity without creating a terminal or placing a trade.

1. Install

Requires Windows with HTTP/2 support, Visual Studio C++ Build Tools and CMake 3.15+. These instructions build from source; they do not assume a registry release exists.

git clone https://github.com/MetaRPC/CppCopier.git
cd CppCopier
cmake -S . -B build
cmake --build build --config Release

Run CMake from a Visual Studio developer shell. The transport uses Windows WinHTTP. CMake downloads the pinned, SHA-256-verified nlohmann/json 3.11.3 dependency for the terminal helpers. Link the CppCopier CMake target so its JSON include path is available; a standalone consumer of demo.hpp must provide nlohmann/json as well.

2. Set your owner key

export MRPC_API_KEY='your-owner-key'
$env:MRPC_API_KEY = 'your-owner-key'

Use the real owner API key, not a broker password, terminal ID or TRIAL. Read authentication if access is refused.

3. Run

.\build\Release\list_copiers.exe

Source: examples/list.cpp.

#include <copier/copier.hpp>
#include <cstdlib>
#include <iostream>
int main() {
    const char* key = std::getenv("MRPC_API_KEY");
    if (!key || !*key) { std::cerr << "Set MRPC_API_KEY\n"; return 1; }
    copier::CopierService service("copy.mrpc.pro:443", key);
    auto result = service.List();
    if (!result.ok) { std::cerr << result.error << "\n"; return 1; }
    for (const auto& item : result.copiers) std::cout << item.id << ": paused=" << item.paused << "\n";
}

A successful empty list means this owner has no copiers. Treat failed requests as errors, not empty accounts.

4. Prepare a demo workflow

Read the lifecycle guide, then choose sizing. Existing replication examples under examples/ are advanced integration examples: they may provision accounts and trade. Inspect them and their cleanup before running with disposable demos. List is the default starting point.