HTTP client for the Traverse graph database management API. Manage databases, files, aliases, schema, and users over HTTP/HTTPS. Zero external dependencies.
$ dotnet add package Traverse.HttpHTTP client for the Traverse graph database management API. Manage databases, files, aliases, schema, and users over HTTP/HTTPS.
dotnet add package Traverse.Http
async/await with CancellationToken support.tvdb files with progress reportingusing Traverse.Http;
var client = new TraverseHttpClient("http://localhost:7691",
new TraverseHttpOptions { ApiKey = "tvs_..." });
// List databases
var databases = await client.ListDatabasesAsync();
foreach (var db in databases)
Console.WriteLine($"{db.Name}: {db.NodeCount} nodes, {db.EdgeCount} edges");
// Run a query
var result = await client.QueryAsync("MATCH (n) RETURN count(n) AS cnt");
Console.WriteLine(result.Rows[0]["cnt"]);
// Create a database
await client.CreateDatabaseAsync("mydb");
// Import Cypher statements
await client.ImportCypherAsync("CREATE (:Person {name: 'Alice'})");
await client.CreateDatabaseAsync("analytics");
await client.RenameDatabaseAsync("analytics", "analytics-v2");
await client.DropDatabaseAsync("analytics-v2");
// Persist all databases to disk
await client.SaveAsync();
// List .tvdb files on the server
var files = await client.ListFilesAsync();
// Upload a database file
await using var stream = File.OpenRead("backup.tvdb");
await client.UploadFileAsync("backup.tvdb", stream);
// Download a database file
await client.DownloadFileAsync("backup.tvdb", "local-copy.tvdb");
// Delete a file from the server
await client.DeleteFileAsync("old-backup.tvdb");
Import nodes and edges from CSV data:
// Import nodes
var csv = "name,age\nAlice,30\nBob,25";
var result = await client.ImportCsvAsync(csv, "Person",
[
new() { Name = "name" },
new() { Name = "age", Type = "integer" }
]);
Console.WriteLine($"{result.NodesCreated} nodes created");
// Import edges
var edgeCsv = "from,to,since\nAlice,Bob,2020";
var edgeResult = await client.ImportCsvEdgesAsync(edgeCsv, "KNOWS",
source: new() { Label = "Person", Column = "from", Property = "name" },
target: new() { Label = "Person", Column = "to", Property = "name" },
columns: [new() { Name = "since", Type = "integer" }]);
Console.WriteLine($"{edgeResult.EdgesCreated} edges created");
// Get database schema
var schema = await client.GetSchemaAsync();
// Manage aliases
var aliases = await client.ListAliasesAsync();
await client.CreateAliasAsync("prod", "main-database");
await client.AlterAliasAsync("prod", "new-database");
await client.DropAliasAsync("prod");
var users = await client.ListUsersAsync();
await client.CreateUserAsync("alice", "secret", role: "admin");
await client.UpdateUserAsync("alice", role: "reader");
await client.DeleteUserAsync("alice");
var health = await client.HealthAsync();
Console.WriteLine($"Status: {health.Status}");
bool ready = await client.ReadyAsync();
Replace a live database with zero downtime using upload → unload → load:
var dbName = "analytics";
var newFile = "analytics-v2.tvdb";
// 1. Upload the new .tvdb file to the server's data directory
await using var stream = File.OpenRead(newFile);
await client.UploadFileAsync(newFile, stream);
// 2. Unload the old database (persists unsaved changes, frees memory)
await client.UnloadDatabaseAsync(dbName);
// 3. Load the new file under the same database name
await client.LoadDatabaseAsync(dbName, newFile);
Both UnloadDatabaseAsync and LoadDatabaseAsync run as async server tasks with optional progress reporting:
var progress = new Progress<TaskInfo>(t =>
Console.WriteLine($"{t.Status}: {t.ProgressPercent}%"));
await client.UnloadDatabaseAsync("analytics", progress);
await client.LoadDatabaseAsync("analytics", "analytics-v2.tvdb", progress);
For alias-based routing, point an alias at the new database instead of reusing the name:
await client.LoadDatabaseAsync("analytics-v2", "analytics-v2.tvdb");
await client.AlterAliasAsync("prod", "analytics-v2");
await client.UnloadDatabaseAsync("analytics-v1");
| Property | Default | Description |
|---|---|---|
ApiKey | null | API key for authentication |
AllowUntrustedCertificate | false | Accept self-signed TLS certificates |
Timeout | 100s | HTTP request timeout |
FileTransferTimeout | infinite | Timeout for file upload/download |
Full documentation at truespar.com/traverse/docs
Copyright 2025-2026 Truespar. All rights reserved.