Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 3c3b591

Browse files
author
German Bichkovich
committed
[auditbox] update api documentation
1 parent 0a35ee2 commit 3c3b591

1 file changed

Lines changed: 56 additions & 43 deletions

File tree

docs-new/auditbox/docs/api.md

Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@ http://localhost:3002
1212

1313
## Authentication
1414

15-
Auditbox uses **Keycloak** for authentication and authorization. To access the FHIR API programmatically, you need to obtain a JWT access token from your Keycloak instance.
15+
Auditbox uses **Keycloak** for authentication and authorization,
16+
although any compliant OAuth2 identity provider (IDP) will work with
17+
proper setup. To access the FHIR API programmatically, you need to
18+
obtain a JWT access token from your IDP instance.
1619

1720
### Getting a Token from Keycloak
1821

19-
All FHIR API requests must include an `Authorization` header with a Bearer token issued by Keycloak:
22+
All FHIR API requests must include an `Authorization` header
23+
with a Bearer token issued by Keycloak:
2024

2125
```http
2226
Authorization: Bearer <your-jwt-token>
2327
```
2428

25-
To obtain a token from Keycloak, use the OAuth 2.0 client credentials or password grant flow. For example:
29+
To obtain a token from Keycloak, use the OAuth 2.0 client credentials
30+
or password grant flow. For example:
2631

2732
```bash
28-
curl -X POST http://localhost:8888/realms/auditbox/protocol/openid-connect/token \
33+
curl http://localhost:8888/realms/auditbox/protocol/openid-connect/token \
2934
-H "Content-Type: application/x-www-form-urlencoded" \
3035
-d "grant_type=password" \
3136
-d "client_id=auditbox" \
@@ -49,7 +54,10 @@ AUDITBOX_API_AUTH_ENABLED=false
4954

5055
### Metadata / Capability Statement
5156

52-
Get the server's capability statement describing supported operations and search parameters.
57+
Get the server's capability statement describing supported operations
58+
and search parameters. While AuditBox is a FHIR server, it specializes
59+
on AuditLogs, thus not implementing features you may expect from
60+
Aidbox.
5361

5462
```http
5563
GET /metadata
@@ -81,33 +89,32 @@ Authorization: Bearer <token>
8189

8290
**Example:**
8391
```bash
84-
curl -X POST http://localhost:3002/AuditEvent \
92+
curl http://localhost:3002/AuditEvent \
8593
-H "Content-Type: application/fhir+json" \
8694
-H "Authorization: Bearer <token>" \
87-
-d '{
88-
"resourceType": "AuditEvent",
89-
"type": {
90-
"system": "http://dicom.nema.org/resources/ontology/DCM",
91-
"code": "110100",
92-
"display": "Application Activity"
93-
},
94-
"action": "E",
95-
"recorded": "2025-01-31T16:03:16Z",
96-
"outcome": "0",
97-
"agent": [{
98-
"requestor": true,
99-
"who": {
100-
"identifier": {
101-
"value": "user@example.com"
102-
}
103-
}
104-
}],
105-
"source": {
106-
"observer": {
107-
"display": "My System"
108-
}
109-
}
110-
}'
95+
-d \
96+
'{
97+
"resourceType": "AuditEvent",
98+
"type": {
99+
"system": "http://dicom.nema.org/resources/ontology/DCM",
100+
"code": "110100",
101+
"display": "Application Activity"
102+
},
103+
"action": "E",
104+
"recorded": "2026-01-16T16:03:16Z",
105+
"outcome": "0",
106+
"agent": [
107+
{
108+
"requestor": true,
109+
"altId": "user@example.com"
110+
}
111+
],
112+
"source": {
113+
"observer": {
114+
"display": "My System"
115+
}
116+
}
117+
}'
111118
```
112119

113120
### Create Bundle
@@ -129,32 +136,33 @@ Authorization: Bearer <token>
129136

130137
**Example:**
131138
```bash
132-
curl -X POST http://localhost:3002/ \
139+
curl http://localhost:3002/ \
133140
-H "Content-Type: application/fhir+json" \
134141
-H "Authorization: Bearer <token>" \
135142
-d '{
136143
"resourceType": "Bundle",
137-
"type": "transaction",
144+
"type": "collection",
138145
"entry": [
139146
{
140147
"resource": {
141148
"resourceType": "AuditEvent",
142149
"type": {
143150
"system": "http://dicom.nema.org/resources/ontology/DCM",
144-
"code": "110100"
151+
"code": "110100",
152+
"display": "Application Activity"
145153
},
146-
"action": "C",
147-
"recorded": "2025-01-31T16:03:16Z",
154+
"action": "E",
155+
"recorded": "2026-01-16T16:03:16Z",
148156
"outcome": "0",
149-
"agent": [{
150-
"requestor": true,
151-
"who": {
152-
"reference": "Practitioner/123"
157+
"agent": [
158+
{
159+
"requestor": true,
160+
"altId": "user@example.com"
153161
}
154-
}],
162+
],
155163
"source": {
156164
"observer": {
157-
"display": "System A"
165+
"display": "My System"
158166
}
159167
}
160168
}
@@ -177,10 +185,15 @@ Authorization: Bearer <token>
177185

178186
**Response:** FHIR AuditEvent resource
179187

188+
**Response:**
189+
- **200 OK** - Returns the FHIR AuditEvent resource or nothing
190+
- **500 Internal Server Error** - Server error occurred
191+
180192
**Example:**
181193
```bash
182-
curl http://localhost:3002/AuditEvent/123 \
183-
-H "Authorization: Bearer <token>"
194+
curl \
195+
-H "Authorization: Bearer <token>" \
196+
http://localhost:3002/AuditEvent/23d0f0ad-3af1-4dab-93d9-9c40a01a58ec
184197
```
185198

186199
### Search AuditEvents

0 commit comments

Comments
 (0)