Graph API
The Graph API provides access to P&ID (Piping and Instrumentation Diagram) graph data. You can retrieve complete graph data or query specific parts using a simple query language.
Authentication
All API requests require authentication using an OAuth2 Bearer token.
Getting a Token
Obtain an access token from the token endpoint:
curl -X POST "https://api.example.com/o/token/" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password&username=YOUR_EMAIL&password=YOUR_PASSWORD&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"
Response:
{
"access_token": "your_access_token",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "your_refresh_token",
"scope": "read write"
}
Using the Token
Include the token in the Authorization header for all API requests:
curl -X GET "https://api.example.com/graph/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Azure AD SSO
The API also supports Azure AD single sign-on for enterprise users. Contact your administrator for Azure AD configuration details.
Quick Start
Get Graph Data
Retrieve the complete graph for a job:
curl -X GET "https://api.example.com/graph/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Query Specific Data
Query only the nodes you need:
curl -X POST "https://api.example.com/graph/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": ".pid_graph.nodes | filter(.node_type == \"pid_component\")"}'
Response
GET returns the full graph:
{
"pid_graph": {
"nodes": [...],
"edges": [...],
"metadata": {
"drawing_name": "P&ID-001",
"job_id": "123",
"schema_version": "1",
"change_version": "1"
}
}
}
POST returns query results:
{
"query": ".pid_graph.nodes | filter(.node_type == \"pid_component\")",
"schema_version": "1",
"change_version": "1",
"result": [...]
}
What's in the Graph?
| Component | Description |
|---|---|
| Nodes | Physical components (valves, pumps, instruments) and logical groupings (pipe systems, loops) |
| Edges | Connections and relationships between nodes |
| Metadata | Drawing information and version details |
Next Steps
- Get Graph Data - Full API reference for retrieving graphs
- Query Graph Data - How to filter and query graph data
- Understanding Nodes - Node types and structure
- Understanding Edges - Edge types and relationships
- Query Examples - Practical query examples