REST Console
Learn how to use REST Console to work with your Aidbox via REST API.

REST Console

REST Console UI
REST Console is designed to work with your Aidbox via REST API. To make a request type an HTTP method (GET, POST, PUT, PATCH, DELETE) and an operation endpoint (for example/Patient β€” please pay attention to the capital letter in the resource name).
Right after the first line you can put HTTP headers. E.g. to use YAML format you can put the following header:
1
Content-type: text/yaml
Copied!
In case you need to send a request body (e.g., POST requests), the request body content is passed below the resource address, separated by an empty line.

Create Patient

Here is an example of creating patient:
Request YAML
Request JSON
Response YAML
Response JSON
1
POST /Patient?_pretty=true
2
Content-Type: text/yaml
3
Accept: text/yaml
4
​
5
resourceType: Patient
6
name:
7
- given:
8
- Max
9
gender: male
10
birthDate: '1990-10-10'
11
address:
12
- line:
13
- 123 Oxygen St
14
city: Hello
15
district: World
16
state: NY
17
postalCode: '3212'
18
telecom:
19
- use: home
20
- system: phone
21
value: "(32) 8934 1234"
22
use: work
23
rank: 1
Copied!
1
POST /Patient?_pretty=true
2
Content-Type: application/json
3
​
4
{
5
"resourceType": "Patient",
6
"name": [
7
{
8
"given": ["Max"]
9
}
10
],
11
"gender": "male",
12
"birthDate": "1990-10-10",
13
"address": [
14
{
15
"line": [
16
"123 Oxygen St"
17
],
18
"city": "Hello",
19
"district": "World",
20
"state": "NY",
21
"postalCode": "3212"
22
}
23
],
24
"telecom": [
25
{
26
"use": "home"
27
},
28
{
29
"system": "phone",
30
"value": "(32) 8934 1234",
31
"use": "work",
32
"rank": 1
33
}
34
]
35
}
Copied!
1
name:
2
- given:
3
- Max
4
gender: male
5
address:
6
- city: Hello
7
line:
8
- 123 Oxygen St
9
state: NY
10
district: World
11
postalCode: '3212'
12
telecom:
13
- use: home
14
- use: work
15
rank: 1
16
value: (32) 8934 1234
17
system: phone
18
birthDate: '1990-10-10'
19
id: '8885ce03-154e-4458-bbb7-09305d86c402'
20
resourceType: Patient
21
meta:
22
lastUpdated: '2021-07-23T14:36:12.392914Z'
23
createdAt: '2021-07-23T14:36:12.392914Z'
24
versionId: '13'
Copied!
1
{
2
"name": [
3
{
4
"given": [
5
"Max"
6
]
7
}
8
],
9
"gender": "male",
10
"address": [
11
{
12
"city": "Hello",
13
"line": [
14
"123 Oxygen St"
15
],
16
"state": "NY",
17
"district": "World",
18
"postalCode": "3212"
19
}
20
],
21
"telecom": [
22
{
23
"use": "home"
24
},
25
{
26
"use": "work",
27
"rank": 1,
28
"value": "(32) 8934 1234",
29
"system": "phone"
30
}
31
],
32
"birthDate": "1990-10-10",
33
"id": "7544300e-8bfa-4929-a7b5-5e1403d0da2d",
34
"resourceType": "Patient",
35
"meta": {
36
"lastUpdated": "2021-07-23T14:37:03.904617Z",
37
"createdAt": "2021-07-23T14:37:03.904617Z",
38
"versionId": "16"
39
}
40
}
Copied!
To get pretty-formatted response add _pretty=true query string parameter:
​

Get Patient

After sending the request, we receive a response with Status - 201 and the sent data, which means that our patient has been created. Use the request GET /Patient/<id> to see the newly created patient. Also the request GET /Patient could be used to get the complete list of patients.
GET /Patient
Request
Response
1
GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true
Copied!
1
Status: 200
2
​
3
{
4
"name": [
5
{
6
"given": [
7
"Max"
8
]
9
}
10
],
11
"gender": "male",
12
"address": [
13
{
14
"city": "Hello",
15
"line": [
16
"123 Oxygen St"
17
],
18
"state": "NY",
19
"district": "World",
20
"postalCode": "3212"
21
}
22
],
23
"telecom": [
24
{
25
"use": "home"
26
},
27
{
28
"use": "work",
29
"rank": 1,
30
"value": "(32) 8934 1234",
31
"system": "phone"
32
}
33
],
34
"birthDate": "1990-10-10",
35
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
36
"resourceType": "Patient",
37
"meta": {
38
"lastUpdated": "2018-10-23T09:47:36.555Z",
39
"versionId": "222",
40
"tag": [
41
{
42
"system": "https://aidbox.io",
43
"code": "created"
44
}
45
]
46
}
47
}
Copied!

Patch Patient

Next step is to update the patient information. For a partial update use PATCH /Patient/<id> in the request body in order to send changed data only. For example, let's change the patient name.
Request
Response
1
PATCH /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true
2
​
3
{
4
"name": [
5
{
6
"given": ["Maximilian"]
7
}
8
]
9
}
Copied!
1
Status: 200
2
​
3
{
4
"name": [
5
{
6
"given": [
7
"Maximilian"
8
]
9
}
10
],
11
"gender": "male",
12
"address": [
13
{
14
"city": "Hello",
15
"line": [
16
"123 Oxygen St"
17
],
18
"state": "NY",
19
"district": "World",
20
"postalCode": "3212"
21
}
22
],
23
"telecom": [
24
{
25
"use": "home"
26
},
27
{
28
"use": "work",
29
"rank": 1,
30
"value": "(32) 8934 1234",
31
"system": "phone"
32
}
33
],
34
"birthDate": "1990-10-10",
35
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
36
"resourceType": "Patient",
37
"meta": {
38
"lastUpdated": "2018-10-23T09:49:24.927Z",
39
"versionId": "223",
40
"tag": [
41
{
42
"system": "https://aidbox.io",
43
"code": "updated"
44
}
45
]
46
}
47
}
Copied!

Update Patient

UsePUT /Patient/<id> to replace the resource.
Request
Response
1
PUT /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577
2
​
3
{
4
"resourceType": "Patient",
5
"id": "example",
6
"name": [
7
{
8
"given": ["Max", "Pain"]
9
}
10
],
11
"gender": "male",
12
"birthDate": "1991-01-02"
13
}
Copied!
1
Status: 200
2
​
3
{
4
"name": [
5
{
6
"given": [
7
"Max",
8
"Pain"
9
]
10
}
11
],
12
"gender": "male",
13
"birthDate": "1991-01-02",
14
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
15
"resourceType": "Patient",
16
"meta": {
17
"lastUpdated": "2018-10-23T09:50:13.639Z",
18
"versionId": "224",
19
"tag": [
20
{
21
"system": "https://aidbox.io",
22
"code": "updated"
23
}
24
]
25
}
26
}
Copied!
In this case, we're updating the data entirely: data that did not get into the request body will be deleted.

Patient History

Use GET /Patient/<id>/_history to receive the version history of the patient resource.
Let's try this for the example patient.
Request
Response
1
GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577/_history?_pretty=true
Copied!
1
Status: 200
2
​
3
{
4
"resourceType": "Bundle",
5
"type": "history",
6
"total": 3,
7
"entry": [
8
{
9
"resource": {
10
"name": [
11
{
12
"given": [
13
"Max",
14
"Pain"
15
]
16
}
17
],
18
"gender": "male",
19
"birthDate": "1991-01-02",
20
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
21
"resourceType": "Patient",
22
"meta": {
23
"lastUpdated": "2018-10-23T09:50:13.639Z",
24
"versionId": "224",
25
"tag": [
26
{
27
"system": "https://aidbox.io",
28
"code": "updated"
29
}
30
]
31
}
32
},
33
"request": {
34
"method": "PUT",
35
"url": "Patient"
36
}
37
},
38
{
39
"resource": {
40
"name": [
41
{
42
"given": [
43
"Maximilian"
44
]
45
}
46
],
47
"gender": "male",
48
"address": [
49
{
50
"city": "Hello",
51
"line": [
52
"123 Oxygen St"
53
],
54
"state": "NY",
55
"district": "World",
56
"postalCode": "3212"
57
}
58
],
59
"telecom": [
60
{
61
"use": "home"
62
},
63
{
64
"use": "work",
65
"rank": 1,
66
"value": "(32) 8934 1234",
67
"system": "phone"
68
}
69
],
70
"birthDate": "1990-10-10",
71
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
72
"resourceType": "Patient",
73
"meta": {
74
"lastUpdated": "2018-10-23T09:49:24.927Z",
75
"versionId": "223",
76
"tag": [
77
{
78
"system": "https://aidbox.io",
79
"code": "updated"
80
}
81
]
82
}
83
},
84
"request": {
85
"method": "PUT",
86
"url": "Patient"
87
}
88
},
89
{
90
"resource": {
91
"name": [
92
{
93
"given": [
94
"Max"
95
]
96
}
97
],
98
"gender": "male",
99
"address": [
100
{
101
"city": "Hello",
102
"line": [
103
"123 Oxygen St"
104
],
105
"state": "NY",
106
"district": "World",
107
"postalCode": "3212"
108
}
109
],
110
"telecom": [
111
{
112
"use": "home"
113
},
114
{
115
"use": "work",
116
"rank": 1,
117
"value": "(32) 8934 1234",
118
"system": "phone"
119
}
120
],
121
"birthDate": "1990-10-10",
122
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
123
"resourceType": "Patient",
124
"meta": {
125
"lastUpdated": "2018-10-23T09:47:36.555Z",
126
"versionId": "222",
127
"tag": [
128
{
129
"system": "https://aidbox.io",
130
"code": "created"
131
}
132
]
133
}
134
},
135
"request": {
136
"method": "POST",
137
"url": "Patient"
138
}
139
}
140
]
141
}
Copied!
The response contains all versions (in this case 3) of the patient resource. The first is the initial state of the resource, the second one has the name changed, and the third is an entirely updated resource.
To get a specific version of a resource use GET /Patient/<id>/_history/<versionId>. It performs the vread operation.
Request
Response
1
GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577/_history/223
Copied!
1
Status: 200
2
​
3
{
4
"name": [
5
{
6
"given": [
7
"Maximilian"
8
]
9
}
10
],
11
"gender": "male",
12
"address": [
13
{
14
"city": "Hello",
15
"line": [
16
"123 Oxygen St"
17
],
18
"state": "NY",
19
"district": "World",
20
"postalCode": "3212"
21
}
22
],
23
"telecom": [
24
{
25
"use": "home"
26
},
27
{
28
"use": "work",
29
"rank": 1,
30
"value": "(32) 8934 1234",
31
"system": "phone"
32
}
33
],
34
"birthDate": "1990-10-10",
35
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
36
"resourceType": "Patient",
37
"meta": {
38
"lastUpdated": "2018-10-23T09:49:24.927Z",
39
"versionId": "223",
40
"tag": [
41
{
42
"system": "https://aidbox.io",
43
"code": "updated"
44
}
45
]
46
}
47
}
Copied!

Search Patient

As an example of using FHIR Search API use GET /Patient?name=<Patient_name> to get all patient with matching names:
Request
Response
1
GET /Patient?name=max&_pretty=true
Copied!
1
Status: 200
2
​
3
{
4
"resourceType": "Bundle",
5
"type": "searchset",
6
"params": [
7
{
8
"resourceType": "Patient",
9
"type": "param",
10
"name": "name",
11
"modifier": null,
12
"values": [
13
{
14
"value": "max"
15
}
16
],
17
"search-param": {
18
"module": "fhir-3.0.1",
19
"name": "name",
20
"id": "Patient.name",
21
"type": "string",
22
"resourceType": "SearchParameter",
23
"resource": {
24
"resourceType": "Entity",
25
"id": "Patient"
26
},
27
"expression": [
28
[
29
"name"
30
]
31
],
32
"typedExpression": [
33
{
34
"path": [
35
"name"
36
],
37
"type": "HumanName"
38
}
39
]
40
}
41
}
42
],
43
"query-sql": [
44
"SELECT \"patient\".* FROM \"patient\" WHERE aidbox_text_search(knife_extract_text(\"patient\".resource, $JSON$[[\"name\",\"family\"],[\"name\",\"given\"],[\"name\",\"middle\"],[\"name\",\"text\"]]$JSON$)) ilike unaccent(?) LIMIT ? OFFSET ?",
45
"% max%",
46
100,
47
0
48
],
49
"query-time": 13,
50
"entry": [
51
{
52
"resource": {
53
"name": [
54
{
55
"given": [
56
"Max",
57
"Pain"
58
]
59
}
60
],
61
"gender": "male",
62
"birthDate": "1991-01-02",
63
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
64
"resourceType": "Patient",
65
"meta": {
66
"lastUpdated": "2018-10-23T09:50:13.639Z",
67
"versionId": "224",
68
"tag": [
69
{
70
"system": "https://aidbox.io",
71
"code": "updated"
72
}
73
]
74
}
75
}
76
}
77
],
78
"total": 1,
79
"link": [
80
{
81
"relation": "first",
82
"url": "/Patient?name=max&_page=1"
83
}
84
]
85
}
Copied!
Please check Search API for more details.

Delete Patient

Use DELETE /Patient/<id>to delete the patient resource.
Request
Response
1
DELETE /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true
Copied!
1
Status: 200
2
​
3
{
4
"name": [
5
{
6
"given": [
7
"Max",
8
"Pain"
9
]
10
}
11
],
12
"gender": "male",
13
"birthDate": "1991-01-02",
14
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
15
"resourceType": "Patient",
16
"meta": {
17
"lastUpdated": "2018-10-23T09:54:16.979Z",
18
"versionId": "225",
19
"tag": [
20
{
21
"system": "https://aidbox.io",
22
"code": "deleted"
23
}
24
]
25
}
26
}
Copied!
After successful deletion, the server sends the response with the status 200 OK and the body containing the last version of the resource.
If we try to get a deleted patientGET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577 we will receive resourceType - OperationOutcome and status 410.
Request
Response
1
GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577
Copied!
1
Status: 410
2
​
3
{
4
"resourceType": "OperationOutcome",
5
"status": 410,
6
"resource": {
7
"name": [
8
{
9
"given": [
10
"Max",
11
"Pain"
12
]
13
}
14
],
15
"gender": "male",
16
"birthDate": "1991-01-02",
17
"id": "f8fe69db-c01c-4a3b-bf0c-0a806ea22577",
18
"resourceType": "Patient",
19
"meta": {
20
"lastUpdated": "2018-10-23T09:54:16.979Z",
21
"versionId": "225",
22
"tag": [
23
{
24
"system": "https://aidbox.io",
25
"code": "deleted"
26
}
27
]
28
}
29
}
30
}
Copied!
Last modified 2mo ago