Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Now that we have our instance up and running, the next step is to understand how to communicate with it. Fortunately, Snow Owl provides very comprehensive and powerful APIs to interact with your instance.
Among the few things that can be done with the API are as follows:
Check your instance health, status, and statistics
Administer your instance data
Perform CRUD (Create, Read, Update, and Delete) and search operations against your terminologies
Execute advanced search operations such as paging, sorting, filtering, scripting, aggregations, and many others
Let’s start with a basic health check, which we can use to see how our instance is doing. We’ll be using curl
to do this but you can use any tool that allows you to make HTTP/REST calls. Let’s assume that we are still on the same node where we started Snow Owl on and open another command shell window.
To check the instance status/health, we will be using the Admin API. You can run the command by clicking the "Copy" link on the right side and pasting it into a terminal.
And the response:
In the response, we can see the version of our instance along with the available repositories and their health status (eg. SNOMED CT
with status GREEN
).
Whenever we ask for the status, we either get GREEN
, YELLOW
, or RED
and an optional diagnosis
message.
Green - everything is good (repository is fully functional)
Yellow - some data or functionality is not available, or diagnostic operation is in progress (repository is partially functional)
Red - diagnostic operation required in order to continue (repository is not functional)
Now that we have a SNOMED CT Code System, let's take a look at its content. We can query its content using either the SNOMED CT API or the FHIR API.
For sake of simplicity, let's search for the available concepts using the SNOMED CT API. For that we will need the branch we would like to query, but fortunately we already know the value from our previous call to the Code Systems API, it was MAIN
. To list all available concepts in a SNOMED CT Code System, use the following command:
And the response is:
Which simply means we have no SNOMED CT concepts yet in our instance.
Now let's take a peek at our code systems:
And the response:
Which means, we have a single Code System in Snow Owl, called SNOMED CT
. It has been created by the SNOMED CT module by default on the first startup of your instance. A Code System lives in a repository and its working branchPath
is currently associated with the default MAIN
branch in the snomedStore
repository.
Now let's import an official SNOMED CT RF2 SNAPSHOT
distribution archive so that we can further explore the available SNOMED CT APIs.
To import an RF2 archive you must first create an import configuration using the as follows:
And the response:
The import configuration specifies the type
of the RF2 release (in this case SNAPSHOT
) and the target branchPath
where the content should imported. The response returns an empty body along with a Location
header with a URL pointing to the created import configuration. You can extract the last part of the URL to get the import configuration ID which can be used to retrieve the configuration and to upload the actual archive and start the import.
Depending on the size and type of the RF2 package, hardware and Snow Owl configuration, RF2 imports might take hours to complete. Official SNAPSHOT distributions can be imported in less than 30 minutes by allocating 6 GB of heap size to Snow Owl and configuring Snow Owl to use a solid state disk for its data directory.
The import will start automatically when you upload the archive to the /imports/:id/archive
endpoint:
The import process is asynchronous and its status can be checked by sending a GET request to the /imports/:id
endpoint with the extracted import identifier as follows:
And the response:
The status
field describes the current state of the import, while the startDate
and completionDate
fields specify start
and completion
timestamps.