BioT SDK
BioT provides SDK as an alternative to working directly with the BioT REST API. Currently, we offer Python SDKs, with each service having its own dedicated SDK package.
Available SDKs
All BioT Python SDKs can be found here.
Getting Started
Before installing and using any SDK, it's important to read the package's README file on PyPI. Each SDK's README contains:
- Installation instructions
- Authentication requirements
- Usage examples
Installation
SDKs can be installed via pip. For example:
pip install [sdk-package-name]Replace [sdk-package-name] with the specific SDK you need from the PyPI search results.
Usage Example
Code example for using generic entity SDK with "firmware-version template".
from typing import Any, Dict
from uuid import UUID
import biotmed_generic_entity_sdk
biot_base_url = "https://api.<>.biot-med.com" # use Rest API URL value from your console app
template_name = "firmware-version"
organization_id = "<your organization id>"
def main():
def get_access_token() -> str:
raise NotImplementedError("Plug in your token (string or callable).")
configuration = biotmed_generic_entity_sdk.Configuration(
host=biot_base_url + "/generic-entity",
access_token=get_access_token,
accept_language=lambda: "en-us",
)
with biotmed_generic_entity_sdk.ApiClient(configuration) as api_client:
api_v3 = biotmed_generic_entity_sdk.GenericEntityAPIV3Api(api_client)
# --- Search ---
search_request = biotmed_generic_entity_sdk.SearchRequestV2(
limit=10,
page=0,
sort=[biotmed_generic_entity_sdk.Order(prop="_creationTime", order="DESC")],
)
response = api_v3.search_generic_entities_v3(template_name, search_request)
# --- Create (1) Direct model + inline custom attributes ---
create_request = biotmed_generic_entity_sdk.CreateGenericEntityByTemplateNameRequest(
_name="firmware-1",
_ownerOrganization=biotmed_generic_entity_sdk.ReferenceAttributeUUIDIdRequest(
id=UUID(organization_id)
),
# Custom attributes:
version="1.0.0", # pyright: ignore[reportCallIssue]
release_notes="Initial release", # pyright: ignore[reportCallIssue]
)
response = api_v3.create_generic_entity_v3(create_request, template_name)
# --- Create (2) Direct model + **kwargs for custom attributes ---
custom_attrs: Dict[str, Any] = {"version": "2.0.0", "release_notes": "Bug fixes"}
create_request = biotmed_generic_entity_sdk.CreateGenericEntityByTemplateNameRequest(
_name="firmware-2",
_ownerOrganization=biotmed_generic_entity_sdk.ReferenceAttributeUUIDIdRequest(
id=UUID(organization_id)
),
**custom_attrs,
)
response = api_v3.create_generic_entity_v3(create_request, template_name)
# --- Create (3) model_validate with dictionary ---
create_request = biotmed_generic_entity_sdk.CreateGenericEntityByTemplateNameRequest.model_validate({
"_name": "firmware-3",
"_ownerOrganization": {"id": organization_id},
# Custom attributes:
"version": "3.0.0",
"release_notes": "Major release",
})
response = api_v3.create_generic_entity_v3(create_request, template_name)
# --- Get ---
response = api_v3.get_generic_entity_v3(template_name, "your-entity-id")
# --- Update ---
update_request = biotmed_generic_entity_sdk.UpdateGenericEntityRequest.model_validate({
"_name": "updated-name",
"version": "1.0.1",
"release_notes": "Updated notes",
})
response = api_v3.update_generic_entity_v3(update_request, template_name, "your-entity-id")Updated 4 days ago
