Complete HTTP API reference for NenDB graph database operations
2 endpoints
/health
Check server health status
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00Z"
}
/status
Get detailed server status and metrics
{
"status": "running",
"uptime": 3600,
"graphs": 5,
"nodes": 1250,
"edges": 3400
}
4 endpoints
/graph/create
Create a new graph
{
"name": "social_network",
"description": "Social network graph"
}
{
"success": true,
"graph_id": "social_network"
}
/graph/list
List all graphs
{
"graphs": [
{
"name": "social_network",
"nodes": 500,
"edges": 1200,
"created": "2024-01-01T00:00:00Z"
}
]
}
/graph/{name}
Get graph information
{
"name": "social_network",
"nodes": 500,
"edges": 1200,
"properties": {
"description": "Social network graph"
}
}
/graph/{name}
Delete a graph and all its data
{
"success": true,
"message": "Graph deleted successfully"
}
5 endpoints
/graph/{name}/nodes
Create one or more nodes
[
{
"id": 1,
"label": "User",
"properties": {
"name": "Alice",
"age": 30
}
},
{
"id": 2,
"label": "User",
"properties": {
"name": "Bob",
"age": 25
}
}
]
{
"success": true,
"nodes_created": 2,
"node_ids": [
1,
2
]
}
/graph/{name}/nodes
Query nodes with filters
{
"label": "User",
"properties": {
"age": {
"$gte": 25
}
}
}
{
"nodes": [
{
"id": 1,
"label": "User",
"properties": {
"name": "Alice",
"age": 30
}
},
{
"id": 2,
"label": "User",
"properties": {
"name": "Bob",
"age": 25
}
}
]
}
/graph/{name}/nodes/{id}
Get a specific node by ID
{
"id": 1,
"label": "User",
"properties": {
"name": "Alice",
"age": 30
}
}
/graph/{name}/nodes/{id}
Update node properties
{
"properties": {
"age": 31,
"city": "New York"
}
}
{
"success": true,
"node_updated": 1
}
/graph/{name}/nodes/{id}
Delete a node and its relationships
{
"success": true,
"node_deleted": 1,
"relationships_deleted": 5
}
5 endpoints
/graph/{name}/edges
Create one or more edges
[
{
"source": 1,
"target": 2,
"label": "FOLLOWS",
"properties": {
"since": "2024-01-01"
}
},
{
"source": 2,
"target": 3,
"label": "FOLLOWS",
"properties": {
"since": "2024-01-02"
}
}
]
{
"success": true,
"edges_created": 2,
"edge_ids": [
1,
2
]
}
/graph/{name}/edges
Query edges with filters
{
"label": "FOLLOWS",
"source": 1
}
{
"edges": [
{
"id": 1,
"source": 1,
"target": 2,
"label": "FOLLOWS",
"properties": {
"since": "2024-01-01"
}
}
]
}
/graph/{name}/edges/{id}
Get a specific edge by ID
{
"id": 1,
"source": 1,
"target": 2,
"label": "FOLLOWS",
"properties": {
"since": "2024-01-01"
}
}
/graph/{name}/edges/{id}
Update edge properties
{
"properties": {
"since": "2024-01-01",
"strength": 0.8
}
}
{
"success": true,
"edge_updated": 1
}
/graph/{name}/edges/{id}
Delete an edge
{
"success": true,
"edge_deleted": 1
}
4 endpoints
/graph/{name}/algorithms/bfs
Breadth-first search traversal
{
"start_node": 1,
"max_depth": 3,
"filters": {
"label": "User"
}
}
{
"nodes": [
1,
2,
3,
4
],
"edges": [
1,
2,
3
],
"depth_map": {
"1": 0,
"2": 1,
"3": 1,
"4": 2
}
}
/graph/{name}/algorithms/dijkstra
Shortest path between nodes
{
"start_node": 1,
"end_node": 5,
"weight_property": "cost"
}
{
"path": [
1,
2,
4,
5
],
"total_cost": 15.5,
"path_edges": [
1,
3,
4
]
}
/graph/{name}/algorithms/pagerank
PageRank centrality algorithm
{
"iterations": 100,
"damping_factor": 0.85,
"tolerance": 0.000001
}
{
"scores": {
"1": 0.15,
"2": 0.12,
"3": 0.08
},
"iterations": 45,
"converged": true
}
/graph/{name}/algorithms/community
Community detection using Louvain method
{
"resolution": 1,
"max_iterations": 100
}
{
"communities": {
"1": 0,
"2": 0,
"3": 1,
"4": 1
},
"modularity": 0.75,
"iterations": 15
}
2 endpoints
/graph/{name}/query
Execute a graph query
{
"query": "MATCH (u:User)-[:FOLLOWS]->(f:User) WHERE u.age > 25 RETURN u.name, f.name"
}
{
"results": [
[
"Alice",
"Bob"
],
[
"Alice",
"Charlie"
]
],
"execution_time": 0.045
}
/graph/{name}/query/explain
Get query execution plan
{
"query": "MATCH (u:User)-[:FOLLOWS]->(f:User) RETURN u.name, f.name"
}
{
"plan": {
"type": "Traversal",
"index_used": "User.age",
"estimated_cost": 150,
"estimated_rows": 100
}
}
Source code and issues