π Connecting via the Automation API
This guide describes how to implement and test a server that works with LabXpert Automation using the Automation API specification.
π§© Overviewβ
LabXpert Automation connects to external systems via HTTP using a well-defined API. To enable this connection, external systems must implement endpoints as defined in the Automation API (Swagger) spec β either in full or selectively, depending on the systemβs role.
β Requirements for Your Serverβ
Must:β
-
Be accessible via HTTP (locally or over a network)
-
Implement one or more of the following endpoints:
GET /tests
GET /requests
POST /machines
POST /results
-
Follow the schemas in the provided OpenAPI document
-
Support Basic Authentication
ποΈ Step 1: Understand the Endpointsβ
Endpoint | Purpose | Required? |
---|---|---|
GET /tests | Returns list of available tests to match machine results | β for systems doing test mapping |
GET /requests | Returns pending test requests (worklist) | β for systems pushing work to Automation |
POST /results | Receives results from Automation | β for systems receiving test results |
POST /machines | Receives machine metadata | Optional, used for inventory sync |
Each endpoint must follow the structure defined in the OpenAPI schemas (see /docs
).
π§ͺ Step 2: Test Your API with Swagger UIβ
-
Open the Swagger API Client using Swagger UI
-
Use the "Try it out" feature to test:
- Authentication
- Schema validation
- Expected responses
βοΈ Step 3: Implement the Endpoints (Any Language)β
You can use any backend language or framework. Here's how it might look conceptually:
Example: GET /requests
β
- Accepts optional query parameters:
testIds
,sampleId
- Returns a JSON array of test request objects
[
{
"id": "req-001",
"date": "2024-05-04T12:00:00Z",
"status": "pending",
"sampleId": "sample-001",
"testId": "hb",
"patient": {
"name": { "givenName": "John", "familyName": "Doe" },
"dob": "2000-01-01T00:00:00Z",
"sex": "M"
}
}
]
Example: POST /results
β
- Receives an array of result objects
- Responds with array of
SyncedItem
confirmations
[
{
"status": "success",
"localId": "result-001",
"remoteId": "server-789"
}
]
Refer to the /components/schemas
in the Swagger spec for detailed structure.
π Step 4: Add Basic Authenticationβ
All requests from Automation use HTTP Basic Auth. Your server should reject requests that do not provide valid credentials.
Example header:
Authorization: Basic YWRtaW46cGFzc3dvcmQ=
Decoded, this is:
username: admin
password: password
π Step 5: Configure Automation to Use Your APIβ
On the Automation app, configure a System to point to your server:
- Base URL: e.g.,
http://192.168.1.10:8080
- Authentication: Basic auth credentials
- Automation will automatically use
/tests
,/requests
, and/results
as needed
π― Tips for a Smooth Integrationβ
- Stick to the spec: The JSON payloads must match exactly (field names, types, structure).
- Log all incoming requests for troubleshooting
- Use ISO 8601 timestamps (e.g.,
"2024-05-04T12:00:00Z"
) - Return clear errors for bad requests (status 400+) and document what went wrong