REST Console

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

REST Console

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/Patientplease 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:

Content-type: text/yaml

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:

POST /Patient?_pretty=true
Content-Type: text/yaml
Accept: text/yaml

resourceType: Patient
name:
- given:
  - Max
gender: male
birthDate: '1990-10-10'
address:
- line:
  - 123 Oxygen St
  city: Hello
  district: World
  state: NY
  postalCode: '3212'
telecom:
- use: home
- system: phone
  value: "(32) 8934 1234"
  use: work
  rank: 1

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/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true

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.

PATCH /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true

{
  "name": [
    {
      "given": ["Maximilian"]
    }
  ]
}

Update Patient

UsePUT /Patient/<id> to replace the resource.

PUT /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577

{
  "resourceType": "Patient",
  "id": "example",
  "name": [
    {
      "given": ["Max", "Pain"]
    }
  ],
  "gender": "male",
  "birthDate": "1991-01-02"
}

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.

GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577/_history?_pretty=true

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.

GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577/_history/223

Search Patient

As an example of using FHIR Search API use GET /Patient?name=<Patient_name> to get all patient with matching names:

GET /Patient?name=max&_pretty=true

Please check Search API for more details.

Delete Patient

Use DELETE /Patient/<id>to delete the patient resource.

DELETE /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577?_pretty=true

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.

GET /Patient/f8fe69db-c01c-4a3b-bf0c-0a806ea22577

Last updated