📡 API Reference
The BioBots REST API provides a unified endpoint for querying bioprinting statistics. All metrics, comparisons, and aggregations use a single URL pattern.
Overview
The API is built on ASP.NET Web API 2 and exposes a single parameterized endpoint that handles all metric queries. Data is loaded from a JSON file and cached in memory with automatic file-watch reload.
Base URL
http://localhost:{port}/api/prints
When running locally via Visual Studio, the port is assigned dynamically. Check the browser URL after launching with F5.
Endpoint
Query print records by metric. Returns a count of matching records (for comparison operations) or a computed value (for aggregation functions).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
metric |
string | The metric to query. See Metrics below. |
comparison |
string | Comparison operator: greater, lesser, or equal |
value |
number | string | Numeric threshold, or aggregation function name (Maximum, Minimum, Average) |
Response Codes
| Code | Description |
|---|---|
| 200 OK | Query executed successfully. Returns a numeric value. |
| 400 Bad Request | Unknown metric, invalid comparison operator, or non-numeric value. |
| 404 Not Found | No valid records in dataset after null filtering. |
Metrics
11 metrics are available for querying, grouped by category:
Print Data
| Metric | Type | Unit | Description |
|---|---|---|---|
livePercent | double | % | Cell viability — percentage alive via live/dead imaging |
deadPercent | double | % | Cell mortality — percentage dead via live/dead imaging |
elasticity | double | kPa | Structural rigidity of the final print |
Crosslinking
| Metric | Type | Unit | Description |
|---|---|---|---|
cl_duration | int | ms | Photocrosslinking duration |
cl_intensity | int | % | Light intensity percentage |
Pressure
| Metric | Type | Unit | Description |
|---|---|---|---|
extruder1 | double | — | Pressure of extruder 1 at print time |
extruder2 | double | — | Pressure of extruder 2 at print time |
Resolution
| Metric | Type | Unit | Description |
|---|---|---|---|
layerHeight | double | mm | Height per layer |
layerNum | int | — | Total number of layers |
Metadata
| Metric | Type | Unit | Description |
|---|---|---|---|
serial | int | — | BioBot 1 serial number |
wellplate | int | — | Wellplate type used (6, 12, 24, 48, 96) |
Comparison Queries
Comparison queries count how many print records satisfy the condition. The response is always an integer count.
| Operator | Meaning | Example |
|---|---|---|
greater |
metric > value | /api/prints/livePercent/greater/50 → count of prints with >50% viability |
lesser |
metric < value | /api/prints/deadPercent/lesser/20 → count of prints with <20% dead cells |
equal |
metric ≈ value | /api/prints/wellplate/equal/6 → count of 6-well plate prints |
Aggregation Queries
Aggregation queries compute a single statistic across all records.
Pass the function name as the value parameter.
The comparison operator is ignored for aggregations.
Aggregation results are returned in O(1) time — statistics are pre-computed when the data file is loaded.
| Function | Returns | Example |
|---|---|---|
Maximum |
Highest value across all records | /api/prints/elasticity/greater/Maximum → max elasticity value |
Minimum |
Lowest value across all records | /api/prints/layerNum/greater/Minimum → min layer count |
Average |
Arithmetic mean across all records | /api/prints/livePercent/greater/Average → average cell viability |
serial,
cl_duration, cl_intensity, layerNum,
wellplate), Maximum and Minimum results are truncated to integers.
Average always returns a double.
Response Format
Success (200 OK)
// Comparison: count of matching records 42 // Aggregation: computed value 87.53
Error (400 Bad Request)
{
"Message": "Unknown metric: 'invalidName'. Valid metrics: serial, livePercent, deadPercent, elasticity, cl_duration, cl_intensity, extruder1, extruder2, layerHeight, layerNum, wellplate."
}
Examples
curl
# Count prints with >50% cell viability curl http://localhost:5000/api/prints/livePercent/greater/50 # Get maximum layer count curl http://localhost:5000/api/prints/layerNum/greater/Maximum # Average elasticity curl http://localhost:5000/api/prints/elasticity/greater/Average # Count prints using 6-well plates curl http://localhost:5000/api/prints/wellplate/equal/6 # Prints with crosslinking <10s curl http://localhost:5000/api/prints/cl_duration/lesser/10000
JavaScript (fetch)
// Count prints with >50% viability const count = await fetch('/api/prints/livePercent/greater/50') .then(r => r.json()); console.log(`${count} prints with >50% viability`); // Get max elasticity const maxElasticity = await fetch('/api/prints/elasticity/greater/Maximum') .then(r => r.json()); console.log(`Max elasticity: ${maxElasticity} kPa`);
C# (HttpClient)
using var client = new HttpClient { BaseAddress = new Uri("http://localhost:5000") };
// Count prints with >50% viability
var count = await client.GetFromJsonAsync<int>("/api/prints/livePercent/greater/50");
// Average elasticity
var avg = await client.GetFromJsonAsync<double>("/api/prints/elasticity/greater/Average");
Try It
Build a query URL interactively: