REST Endpoints¶
Detailed documentation for all REST API endpoints.
PV Endpoints¶
Search PVs¶
Search for PVs with optional filters.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
query |
string | Search term (matches address or description) |
tag_ids |
array | Filter by tag IDs |
limit |
integer | Max results (default: 100) |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"setpoint_address": "QUAD:LI21:201:BDES",
"readback_address": "QUAD:LI21:201:BACT",
"description": "Quadrupole magnet",
"tags": [
{"id": "...", "name": "Magnet"}
]
}
]
}
Search PVs (Paginated)¶
Search PVs with cursor-based pagination.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
query |
string | Search term |
tag_ids |
array | Filter by tag IDs |
limit |
integer | Page size (default: 100) |
cursor |
string | Continuation token |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"items": [...],
"next_cursor": "eyJpZCI6IjU1MGU4...",
"has_more": true
}
}
Create PV¶
Create a new PV.
Request Body:
{
"setpoint_address": "TEST:PV:SETPOINT",
"readback_address": "TEST:PV:READBACK",
"config_address": null,
"device": "Test Device",
"description": "Test PV for documentation",
"abs_tolerance": 0.01,
"rel_tolerance": 0.001,
"tag_ids": ["550e8400-e29b-41d4-a716-446655440000"]
}
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"setpoint_address": "TEST:PV:SETPOINT",
"readback_address": "TEST:PV:READBACK",
...
}
}
Bulk Create PVs¶
Create multiple PVs in a single request.
Request Body:
{
"pvs": [
{
"setpoint_address": "PV:1",
"description": "First PV"
},
{
"setpoint_address": "PV:2",
"description": "Second PV"
}
]
}
Update PV¶
Update an existing PV.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
UUID | PV ID |
Request Body:
Delete PV¶
Delete a PV.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
UUID | PV ID |
Snapshot Endpoints¶
List Snapshots¶
List all snapshots.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
limit |
integer | Max results |
offset |
integer | Skip N results |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": [
{
"id": "...",
"title": "Morning snapshot",
"comment": "Before tuning",
"created_by": "operator",
"created_at": "2024-01-15T10:30:00Z",
"pv_count": 1500
}
]
}
Create Snapshot¶
Create a new snapshot (asynchronous operation).
Request Body:
{
"title": "Morning snapshot",
"comment": "Before beam tuning",
"created_by": "operator",
"pv_ids": ["...", "..."],
"tag_ids": ["..."],
"use_cache": true
}
| Field | Type | Description |
|---|---|---|
title |
string | Snapshot name |
comment |
string | Optional description |
created_by |
string | Creator identifier |
pv_ids |
array | Specific PVs to include |
tag_ids |
array | Include PVs with these tags |
use_cache |
boolean | Read from Redis cache (fast) or EPICS (fresh) |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"job_id": "770e8400-e29b-41d4-a716-446655440002"
}
}
Poll /v1/jobs/{job_id} for progress and completion.
Get Snapshot¶
Get a snapshot with all its values.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
UUID | Snapshot ID |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"id": "...",
"title": "Morning snapshot",
"values": [
{
"pv_name": "QUAD:LI21:201:BDES",
"setpoint_value": 42.5,
"readback_value": 42.48,
"status": 0,
"severity": 0
}
]
}
}
Delete Snapshot¶
Delete a snapshot and all its values.
Restore Snapshot¶
Restore snapshot values to EPICS (asynchronous operation).
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"job_id": "880e8400-e29b-41d4-a716-446655440003"
}
}
Compare Snapshots¶
Compare two snapshots and show differences.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
tolerance |
float | Difference threshold (default: uses PV tolerances) |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"snapshot1_id": "...",
"snapshot2_id": "...",
"differences": [
{
"pv_name": "QUAD:LI21:201:BDES",
"value1": 42.5,
"value2": 43.2,
"diff": 0.7,
"diff_percent": 1.6
}
],
"total_pvs": 1500,
"different_count": 23
}
}
Tag Endpoints¶
List Tag Groups¶
List all tag groups with their tags.
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": [
{
"id": "...",
"name": "Area",
"description": "Machine areas",
"tags": [
{"id": "...", "name": "LI21"},
{"id": "...", "name": "LI22"}
]
}
]
}
Create Tag Group¶
Create a new tag group.
Request Body:
{
"name": "Subsystem",
"description": "Device subsystems",
"tags": [
{"name": "Magnet"},
{"name": "BPM"},
{"name": "Feedback"}
]
}
Get Tag Group¶
Get a tag group with all its tags.
Update Tag Group¶
Update a tag group.
Delete Tag Group¶
Delete a tag group and all its tags.
Job Endpoints¶
Get Job Status¶
Get the status and progress of a background job.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
UUID | Job ID |
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"id": "...",
"type": "CREATE_SNAPSHOT",
"status": "IN_PROGRESS",
"progress": 45,
"data": {
"processed": 675,
"total": 1500
},
"result_id": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:15Z"
}
}
Job Status Values:
| Status | Description |
|---|---|
PENDING |
Job created, waiting for worker |
IN_PROGRESS |
Worker is processing |
COMPLETED |
Successfully finished |
FAILED |
Error occurred |
RETRYING |
Automatic retry in progress |
Health Endpoints¶
Overall Health¶
Check overall API health.
Database Health¶
Check database connectivity.
Redis Health¶
Check Redis connectivity.
Monitor Status¶
Check PV monitor process health.
Response:
{
"errorCode": 0,
"errorMessage": null,
"payload": {
"healthy": true,
"last_heartbeat": "2024-01-15T10:30:00Z",
"pv_count": 40000,
"connected_count": 39850
}
}
Circuit Breaker Status¶
Check circuit breaker status by IOC prefix.
Response: