N

NenDB API

Complete HTTP API reference for NenDB graph database operations

REST APIJSONHTTP/1.1

API Categories

🏥Health & Status

2 endpoints

GET/health

Check server health status

Response:
{
  "status": "healthy",
  "timestamp": "2024-01-01T00:00:00Z"
}
GET/status

Get detailed server status and metrics

Response:
{
  "status": "running",
  "uptime": 3600,
  "graphs": 5,
  "nodes": 1250,
  "edges": 3400
}
📊Graph Management

4 endpoints

POST/graph/create

Create a new graph

Request Example:
{
  "name": "social_network",
  "description": "Social network graph"
}
Response:
{
  "success": true,
  "graph_id": "social_network"
}
GET/graph/list

List all graphs

Response:
{
  "graphs": [
    {
      "name": "social_network",
      "nodes": 500,
      "edges": 1200,
      "created": "2024-01-01T00:00:00Z"
    }
  ]
}
GET/graph/{name}

Get graph information

Response:
{
  "name": "social_network",
  "nodes": 500,
  "edges": 1200,
  "properties": {
    "description": "Social network graph"
  }
}
DELETE/graph/{name}

Delete a graph and all its data

Response:
{
  "success": true,
  "message": "Graph deleted successfully"
}
🔵Node Operations

5 endpoints

POST/graph/{name}/nodes

Create one or more nodes

Request Example:
[
  {
    "id": 1,
    "label": "User",
    "properties": {
      "name": "Alice",
      "age": 30
    }
  },
  {
    "id": 2,
    "label": "User",
    "properties": {
      "name": "Bob",
      "age": 25
    }
  }
]
Response:
{
  "success": true,
  "nodes_created": 2,
  "node_ids": [
    1,
    2
  ]
}
GET/graph/{name}/nodes

Query nodes with filters

Request Example:
{
  "label": "User",
  "properties": {
    "age": {
      "$gte": 25
    }
  }
}
Response:
{
  "nodes": [
    {
      "id": 1,
      "label": "User",
      "properties": {
        "name": "Alice",
        "age": 30
      }
    },
    {
      "id": 2,
      "label": "User",
      "properties": {
        "name": "Bob",
        "age": 25
      }
    }
  ]
}
GET/graph/{name}/nodes/{id}

Get a specific node by ID

Response:
{
  "id": 1,
  "label": "User",
  "properties": {
    "name": "Alice",
    "age": 30
  }
}
PUT/graph/{name}/nodes/{id}

Update node properties

Request Example:
{
  "properties": {
    "age": 31,
    "city": "New York"
  }
}
Response:
{
  "success": true,
  "node_updated": 1
}
DELETE/graph/{name}/nodes/{id}

Delete a node and its relationships

Response:
{
  "success": true,
  "node_deleted": 1,
  "relationships_deleted": 5
}
🔗Edge Operations

5 endpoints

POST/graph/{name}/edges

Create one or more edges

Request Example:
[
  {
    "source": 1,
    "target": 2,
    "label": "FOLLOWS",
    "properties": {
      "since": "2024-01-01"
    }
  },
  {
    "source": 2,
    "target": 3,
    "label": "FOLLOWS",
    "properties": {
      "since": "2024-01-02"
    }
  }
]
Response:
{
  "success": true,
  "edges_created": 2,
  "edge_ids": [
    1,
    2
  ]
}
GET/graph/{name}/edges

Query edges with filters

Request Example:
{
  "label": "FOLLOWS",
  "source": 1
}
Response:
{
  "edges": [
    {
      "id": 1,
      "source": 1,
      "target": 2,
      "label": "FOLLOWS",
      "properties": {
        "since": "2024-01-01"
      }
    }
  ]
}
GET/graph/{name}/edges/{id}

Get a specific edge by ID

Response:
{
  "id": 1,
  "source": 1,
  "target": 2,
  "label": "FOLLOWS",
  "properties": {
    "since": "2024-01-01"
  }
}
PUT/graph/{name}/edges/{id}

Update edge properties

Request Example:
{
  "properties": {
    "since": "2024-01-01",
    "strength": 0.8
  }
}
Response:
{
  "success": true,
  "edge_updated": 1
}
DELETE/graph/{name}/edges/{id}

Delete an edge

Response:
{
  "success": true,
  "edge_deleted": 1
}
🧮Graph Algorithms

4 endpoints

POST/graph/{name}/algorithms/bfs

Breadth-first search traversal

Request Example:
{
  "start_node": 1,
  "max_depth": 3,
  "filters": {
    "label": "User"
  }
}
Response:
{
  "nodes": [
    1,
    2,
    3,
    4
  ],
  "edges": [
    1,
    2,
    3
  ],
  "depth_map": {
    "1": 0,
    "2": 1,
    "3": 1,
    "4": 2
  }
}
POST/graph/{name}/algorithms/dijkstra

Shortest path between nodes

Request Example:
{
  "start_node": 1,
  "end_node": 5,
  "weight_property": "cost"
}
Response:
{
  "path": [
    1,
    2,
    4,
    5
  ],
  "total_cost": 15.5,
  "path_edges": [
    1,
    3,
    4
  ]
}
POST/graph/{name}/algorithms/pagerank

PageRank centrality algorithm

Request Example:
{
  "iterations": 100,
  "damping_factor": 0.85,
  "tolerance": 0.000001
}
Response:
{
  "scores": {
    "1": 0.15,
    "2": 0.12,
    "3": 0.08
  },
  "iterations": 45,
  "converged": true
}
POST/graph/{name}/algorithms/community

Community detection using Louvain method

Request Example:
{
  "resolution": 1,
  "max_iterations": 100
}
Response:
{
  "communities": {
    "1": 0,
    "2": 0,
    "3": 1,
    "4": 1
  },
  "modularity": 0.75,
  "iterations": 15
}
🔍Graph Queries

2 endpoints

POST/graph/{name}/query

Execute a graph query

Request Example:
{
  "query": "MATCH (u:User)-[:FOLLOWS]->(f:User) WHERE u.age > 25 RETURN u.name, f.name"
}
Response:
{
  "results": [
    [
      "Alice",
      "Bob"
    ],
    [
      "Alice",
      "Charlie"
    ]
  ],
  "execution_time": 0.045
}
POST/graph/{name}/query/explain

Get query execution plan

Request Example:
{
  "query": "MATCH (u:User)-[:FOLLOWS]->(f:User) RETURN u.name, f.name"
}
Response:
{
  "plan": {
    "type": "Traversal",
    "index_used": "User.age",
    "estimated_cost": 150,
    "estimated_rows": 100
  }
}

Additional Resources

Python Client

Full Python client documentation

Graph Algorithms

Detailed algorithm documentation

GitHub Repository

Source code and issues