Skip to main content

Get Graph Data

Retrieve the complete P&ID graph for a job.

Endpoint

GET /graph/:job_id

Example Request

curl -X GET "https://api.example.com/graph/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "X-Schema-Version: 1"

Headers

HeaderRequiredDescription
AuthorizationYesBearer token for authentication.
X-Schema-VersionNoSchema version for output format. Defaults to latest.
X-Change-VersionNoSpecific graph version. Defaults to latest.

Response

{
"pid_graph": {
"nodes": [
{
"tag": "FV-101",
"id": "abc-123",
"node_type": "pid_component",
"node_classification": "piping_component.gate_valve",
"orig_x": 150.5,
"orig_y": 200.3,
"orig_bbox_width": 50.0,
"orig_bbox_height": 40.0,
"attributes": [...]
}
],
"edges": [
{
"id": "edge-456",
"edge_type": "physically_connected_to",
"edge_classification": "process_line.secondary_process_line",
"from": { "...node..." },
"to": { "...node..." },
"orig_from_x": 100.0,
"orig_from_y": 200.0,
"orig_to_x": 300.0,
"orig_to_y": 200.0,
"attributes": [...]
}
],
"metadata": {
"drawing_name": "P&ID-001",
"job_id": "123",
"project_id": "456",
"collection_id": "789",
"unit": "",
"area": "",
"schema_version": "1",
"change_version": "1"
}
}
}

Get Specific Version

To retrieve a specific version of the graph:

curl -X GET "https://api.example.com/graph/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "X-Change-Version: 2"

List Available Versions

To see all available versions for a job:

curl -X GET "https://api.example.com/graph/123/versions" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response:

{
"job_id": 123,
"versions": [
{"change_version": 2, "created_on": "2024-01-15T10:30:00Z"},
{"change_version": 1, "created_on": "2024-01-14T09:00:00Z"}
],
"latest_version": 2
}

See Also