Python examples
Manage Time Series Databases
List all time series databases
This code gets a list of time series databases for the Factry Historian organization (my Swagger).
def list_ts_databases():
resp = session.get(f"{BASE_URL}/timeseries-databases", timeout=30)
resp.raise_for_status()
return resp.json()
ts_db_list = list_ts_databases()
print(json.dumps(ts_db_list, indent=2))[
{
"UUID": "8bcc36ec-5c09-11f0-861a-ba2c68c81159",
"CreatedBy": "6c8ef372-5c29-11ef-9e88-0242ac12000a",
"CreatedAt": "2025-07-08T14:40:51.834631Z",
"UpdatedBy": "6c8ef372-5c29-11ef-9e88-0242ac12000a",
"UpdatedAt": "2025-07-08T14:40:51.964226Z",
"Attributes": {},
"Metadata": {},
"OrganizationUUID": "fbf184b2-5c29-11ef-8bf9-0242ac12000a",
"Settings": {
"database": "database1",
"host": "http://localhost:8086",
"roUsername": "grafana",
"username": "factry"
},
"SecureSettings": {
"password": "4V3n5dz50pk6ShUspfSsSCpJ-E6z6uzz1Bh-3k4NkHlYxIyyqg==",
"roPassword": "hhhUWXMp7Mg9hfTSRCrFyynsENuQSexKBcpzu3p-QnoATiwd0w=="
},
"TimeseriesDatabaseType": {
"UUID": "6c8e8982-5c29-11ef-9e88-0242ac12000a",
"CreatedBy": null,
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedBy": null,
"UpdatedAt": "0001-01-01T00:00:00Z",
"Attributes": null,
"Metadata": {},
"Name": "Influx",
"SettingsSchema": {
"$id": "http://example.com/example.json",
"$schema": "http://json-schema.org/draft-07/schema",
"additionalProperties": true,
"default": {},
"description": "The root schema comprises the entire JSON document.",
"properties": {
"database": {
"$id": "#/properties/database",
"default": "",
"description": "The name of the database on the Influx host",
"examples": [
"looms"
],
"order": 3,
"title": "Database",
"type": "string"
},
"host": {
"$id": "#/properties/host",
"default": "http://127.0.0.1:8086",
"description": "The host for the Influx database",
"examples": [
"http://127.0.0.1:8086"
],
"order": 2,
"pattern": "https?:\\/\\/.*:[0-9]+",
"title": "Host",
"type": "string"
},
"password": {
"$id": "#/properties/password",
"default": "",
"description": "The password used to authenticate on the Influx host",
"examples": [
"password"
],
"order": 1,
"password": true,
"secure": true,
"title": "Admin password",
"type": "string"
},
"roPassword": {
"$id": "#/properties/roPassword",
"default": "",
"description": "The password used for read only access",
"examples": [
"password"
],
"order": 5,
"password": true,
"secure": true,
"title": "Read only password",
"type": "string"
},
"roUsername": {
"$id": "#/properties/roUsername",
"default": "grafana",
"description": "The username used for read only access, if create database is checked and the user does not exist, the user will be created automatically.",
"examples": [
"grafana"
],
"order": 4,
"title": "Read only user",
"type": "string"
},
"username": {
"$id": "#/properties/username",
"default": "factry",
"description": "The username used to log in to the Influx host",
"examples": [
"username"
],
"order": 0,
"title": "Admin user",
"type": "string"
}
},
"required": [
"username",
"password",
"host",
"database",
"roUsername",
"roPassword"
],
"title": "The Root Schema",
"type": "object"
}
},
"Name": "database1",
"Description": "",
"Status": "Active",
"TimeseriesDatabaseTypeUUID": "6c8e8982-5c29-11ef-9e88-0242ac12000a",
"Required": false
},
{
"UUID": "19bdd45c-5c2d-11ef-ae29-0242ac12000a",
"CreatedBy": "6c8ef372-5c29-11ef-9e88-0242ac12000a",
"CreatedAt": "2024-08-17T00:10:24.691858Z",
"UpdatedBy": "6c8ef372-5c29-11ef-9e88-0242ac12000a",
"UpdatedAt": "2025-09-18T15:08:32.174027Z",
"Attributes": {},
"Metadata": {},
"OrganizationUUID": "fbf184b2-5c29-11ef-8bf9-0242ac12000a",
"Settings": {
"database": "database2",
"host": "http://localhost:8086",
"roUsername": "grafana",
"username": "factry"
},
"SecureSettings": {
"password": "oti7EZlhgXhWrg3aSikACi69_u0vw0-BG-ZNQKZuXCC-QVMqxw==",
"roPassword": "NtbjLZf-zFeWSfgy6Xq3ZDSIvstai8p_9Mz3GMzbMHCm2xm3Fg=="
},
"TimeseriesDatabaseType": {
"UUID": "6c8e8982-5c29-11ef-9e88-0242ac12000a",
"CreatedBy": null,
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedBy": null,
"UpdatedAt": "0001-01-01T00:00:00Z",
"Attributes": null,
"Metadata": {},
"Name": "Influx",
"SettingsSchema": {
"$id": "http://example.com/example.json",
"$schema": "http://json-schema.org/draft-07/schema",
"additionalProperties": true,
"default": {},
"description": "The root schema comprises the entire JSON document.",
"properties": {
"database": {
"$id": "#/properties/database",
"default": "",
"description": "The name of the database on the Influx host",
"examples": [
"looms"
],
"order": 3,
"title": "Database",
"type": "string"
},
"host": {
"$id": "#/properties/host",
"default": "http://127.0.0.1:8086",
"description": "The host for the Influx database",
"examples": [
"http://127.0.0.1:8086"
],
"order": 2,
"pattern": "https?:\\/\\/.*:[0-9]+",
"title": "Host",
"type": "string"
},
"password": {
"$id": "#/properties/password",
"default": "",
"description": "The password used to authenticate on the Influx host",
"examples": [
"password"
],
"order": 1,
"password": true,
"secure": true,
"title": "Admin password",
"type": "string"
},
"roPassword": {
"$id": "#/properties/roPassword",
"default": "",
"description": "The password used for read only access",
"examples": [
"password"
],
"order": 5,
"password": true,
"secure": true,
"title": "Read only password",
"type": "string"
},
"roUsername": {
"$id": "#/properties/roUsername",
"default": "grafana",
"description": "The username used for read only access, if create database is checked and the user does not exist, the user will be created automatically.",
"examples": [
"grafana"
],
"order": 4,
"title": "Read only user",
"type": "string"
},
"username": {
"$id": "#/properties/username",
"default": "factry",
"description": "The username used to log in to the Influx host",
"examples": [
"username"
],
"order": 0,
"title": "Admin user",
"type": "string"
}
},
"required": [
"username",
"password",
"host",
"database",
"roUsername",
"roPassword"
],
"title": "The Root Schema",
"type": "object"
}
},
"Name": "database2",
"Description": "",
"Status": "Active",
"TimeseriesDatabaseTypeUUID": "6c8e8982-5c29-11ef-9e88-0242ac12000a",
"Required": false
}
]