Overview
Client libraries for JavaScript, TypeScript and Python.
Clinia publishes a client for JavaScript and TypeScript, @clinia/context-engine-js, and a client for Python, clinia-context-engine. Both are generated from the API specification at every release, so each REST operation has a method in both clients and each client matches the API version it was released with.
Each client handles three parts of working with the API for you:
- It gets an access token with your client credentials, keeps it and renews it before it expires, so your code never handles a token.
- It gives each operation a method, grouped by area of the API: service info, patients, ingestion, sessions, the virtual file system and the graph.
- It types every request and response, so your editor suggests field names and your type checker flags a wrong field before the request is sent.
| JavaScript and TypeScript | Python | |
|---|---|---|
| Runs on | Node 20+ and modern browsers | Python 3.10+ |
| Calling style | Each method returns a promise | A synchronous client and an asynchronous client with the same methods |
| Errors | Returned as values alongside the data | Raised as exceptions |
In JavaScript, you check each result for an error before you use its data. In Python, you catch the exception where you want to handle the failure, as described in the JavaScript and Python client pages.
Without a client, your code calls the same operations over plain HTTP, as described in the API reference.
To start using a client, follow its page: JavaScript Client or Python Client.