REST API

The covid-ht REST API consists mainly of four endpoints:

  • /classify

  • /classify-dataset

  • /data

  • /data/{uuid}

This is what allows to:

  • integrate with third-party software for:
    • data inputing, i.e. hematology equipements, clinical records software, alternative front-ends,

    • providing classification services, i.e. clinical records software, alternative front-ends, etc.

  • network with other instances to collaborate for providing a better service.

The REST API is namespaced to /api/v1.

It is developed with django-rest-framework, the specification is available in the /openapi endpoint and the implementation details can be found through base.v1.views and data.v1.views.

An HTML front-end is available for its endpoints.

Classification REST API Endpoints

  • /classify

  • /classify-dataset

Both endpoints provide the information of the classification service via GET requests and the service itself via POST.

The difference between endpoints is how the request is done. The first one accepts an observation “directly” while the second a list of observations in the dataset key, as shown here.

If the use_network GET parameter is set to true with a POST request - i.e. POST /api/v1/classify/?use_network=TRUE - it will provide network classification and include the voting information in the response.

Setting the graph GET parameter to true in a POST request - i.e. POST /api/v1/classify/?graph=true will include the generated graph of the classification in SVG format under the graph key in the response.

Data REST API Endpoints

  • /data

  • /data/{uuid}

It provides the input and retrieving of data to / from the instance.

The first one (/data) provides listing through GET and creation through POST.

The second one (/data/{uuid}) provides retrieve through GET and update through POST.

Note

/data also provides creation and updating through PUT and PATCH which are intended for data sharing between Network Nodes (see Networking).

Authentication

Token authentication is supported with the Authorization: Token <TOKEN> header and session authentication is available in /api/auth/login and /api/auth/logout.