Configuration
This page is for the practitioner who needs admin-style metadata and configuration operations.
All snippets below assume svi is an authenticated SVIClient.
Before this example
Configuration names and ids are deployment-specific. Before you adapt a snippet, use Discover Your Environment to find:
- the real entity type name behind
"<your-entity-type>" - the real child entity name behind
"<your-child-entity-type>" - the real reference-list name behind
"<your-reference-list-name>" - the real domain, strategy, or search type names in your environment
Move configuration between tenants
The SDK offers two ZIP formats. Pick by what you are moving:
| You want to move | Use | Dry run |
|---|---|---|
| The whole solution: entities, relationships, workflows, reference lists, pages, SAND and alert configuration, groups | svi.admin.config.export_archive() (SAS transport archive) | No |
| Only SAND search/visualization configuration and/or the alerts package | svi.admin.config.export_bundle() (SDK bundle) | Yes, for SAND |
Full solution transport
Both formats live on svi.admin.config. Its archive methods wrap the two public operations
of the SAS Transport API: exportAll and
importAllFromZip. The same operations are also available one level down, on
svi.admin.transport (export_all / import_all).
archive = svi.admin.config.export_archive()
print(archive.system_version, archive.entry_count)
print(archive.services) # {"svi-datahub": 1037, "svi-sand": 85, ...}
archive.save_zip("vi-full.zip")
A large solution does not need to pass through memory. Give the export a path and it streams there one chunk at a time:
path = svi.admin.config.export_archive(to_path="vi-full.zip", overwrite=True)
The file is written 0600 to a temporary file next to the destination, checked to be a transport
archive, and only then moved into place. A failed export leaves no partial file and does not touch
an existing one. max_response_bytes caps a streamed export the same way it caps a buffered one.
Inspect an archive offline before importing it. summary() counts files per folder:
archive = svi.admin.config.load_archive("vi-full.zip")
print(archive.summary()["svi-datahub/documents"])
load_archive, import_archive, load_bundle and import_bundle read a source up to the
client's max_response_bytes (1 GiB by default), and never less than 256 MiB, so a client can load
whatever it could have exported. The classmethods TransportArchive.from_zip and
ConfigurationBundle.from_zip have no client to ask: they default to 256 MiB and take
max_bytes= when you need more. A bundle's entries have a separate, fixed cap once expanded: 64 MiB
per component and 128 MiB in total, whatever the source size.
Import it into another tenant:
result = target.admin.config.import_archive("vi-full.zip")
print(result.to_dict())
What to know before importing:
- There is no dry run and no per-object selection. The whole archive is applied in one step.
Export the target first (
target.admin.config.export_archive().save_zip(...)) if you may need to roll back. - Expect an upsert. SAS documents the Transport merge import this way. Objects whose natural key matches are replaced, new ones are added, and existing objects missing from the archive are left alone. A tenant importing its own archive back round-trips cleanly (live-verified), but the SDK has not yet proved the merge rule with an archive that differs from the target.
- Large archives are slow. A 1,300-file solution exports in roughly 20 seconds, close to the
client's default 30-second timeout. Both calls therefore take their own
timeout: 300 seconds for export and 600 for import by default. - Queued imports are awaited. If the server answers 202,
import_archivepolls the job until it finishes ortimeoutruns out. Passwait=Falseto return at once withresult.pendingset andresult.job_urlpointing at the job, then hand either one tosvi.admin.transport.wait_for_import(...)when you want the outcome. - A wait that ends early never loses the job. A status check that times out or gets a 5xx is
logged at WARNING and tried again at the next interval. Five failures in a row, a rejected
status check, or a spent
timeoutraiseConfigurationImportError, and itsresult.job_urlis always set. The import keeps running on the server, so re-attach instead of importing again. - Failures carry every message. Provider errors, failed jobs and timeouts raise
ConfigurationImportError. Itsresultis theTransportImportResultwith all provider responses and messages, anddetailslists them.
Start an import, keep the job URL, and pick it up later, from another process if you like:
from sasvi.errors import ConfigurationImportError
submitted = target.admin.config.import_archive("vi-full.zip", wait=False)
print(submitted.job_url) # save this
try:
result = target.admin.transport.wait_for_import(submitted.job_url, timeout=900)
except ConfigurationImportError as error:
print(error, error.result.job_url) # still running? wait again with the same URL
else:
print(result.job_status, result.success)
wait_for_import accepts a URL on the transport service's origin only, because the status request
carries your bearer token. wait_for_import_async is the coroutine twin.
If you call the endpoint yourself, send the ZIP bytes as the raw request body with
Content-Type: application/zip. It is not multipart and not JSON. With curl, that means
--data-binary @vi-full.zip; plain --data strips line breaks and corrupts the ZIP.
The archive includes groups, memberships and deployment-specific settings. Treat it as deployment material and keep it out of source control.
Targeted SAND and alerts bundles
There are two paths. The dry run (validate_only=True) tells you whether the bundle will apply
cleanly before any writes. The real import (validate_only=False) persists the SAND component and
unpacks the alerts package. Use the dry run first on production targets.
Use svi.admin.config.export_bundle() when you want a portable SDK bundle that includes both
SAND search/entity visualization configuration and the alerts configuration package.
bundle = svi.admin.config.export_bundle()
bundle.save_zip("vi-config.zip")
print(bundle.to_dict())
Later, load and import the same SDK bundle:
bundle = svi.admin.config.load_bundle("vi-config.zip")
result = svi.admin.config.import_bundle(bundle)
print(result.to_dict())
You can also use the path helper directly:
svi.admin.config.export_bundle_zip("vi-config.zip", overwrite=True)
result = svi.admin.config.import_bundle_zip("vi-config.zip")
The SDK bundle ZIP has its own manifest and contains the different backend formats side by side:
sand/config.json for SAND configuration and alerts/config.zip for the native alerts package.
Export only one component when needed:
sand_bundle = svi.admin.config.export_bundle(include=("sand",))
alerts_bundle = svi.admin.config.export_bundle(include=("alerts",))
Validate-only imports apply to SAND configuration. Alerts package import has no validation-only API,
so the SDK skips alerts when validate_only=True:
result = svi.admin.config.import_bundle(
"vi-config.zip",
validate_only=True,
)
print(result.to_dict())
Each component's import request gets its own timeout, 600 seconds by default, rather than the
client's 30-second one. A SAND import replaces every entity type and can take minutes even on a
small tenant; raise timeout for a large configuration:
result = svi.admin.config.import_bundle("vi-config.zip", timeout=1800)
A bundle import sends one request per component, so it can fail half way. The error tells you how:
| The import raises | It means | error.result |
|---|---|---|
ConfigurationImportError | The server rejected a component. status_code, error_code and details come from that rejection. | Every component attempted; the rejected one has success=False. |
NetworkError (also a timeout) | A request got no complete response. Read outcome_unknown before importing again. | The failed component is pending when the server may have applied it. |
MalformedResponseError | The server answered 2xx with a body the SDK could not read. | The failed component is pending. |
from sasvi.errors import ConfigurationImportError, NetworkError
try:
svi.admin.config.import_bundle("vi-config.zip")
except NetworkError as error:
print(error.outcome_unknown, error.result.to_dict())
except ConfigurationImportError as error:
print(error.status_code, error.details, error.result.to_dict())
To queue the alerts import as a server job instead of waiting for it, pass alerts_async=True
with a job_id and a task_id. The endpoint requires both, and the SDK refuses the call before
sending anything when one is missing. The server answers 202, which means "accepted, not
completed", so the result is pending and not a success:
result = svi.admin.config.import_bundle(
"vi-config.zip",
alerts_async=True,
job_id="<your-job-id>",
task_id="<your-task-id>",
)
print(result.success, result.pending) # False True
print(result.alerts.job_id, result.alerts.task_id)
The alerts API publishes no status endpoint for that job, so check the alerts configuration on the
tenant before you rely on it. sasvi config import prints "queued" for such a result.
Configuration exports can contain deployment-sensitive settings. Store bundle ZIP files as deployment material and keep them out of source control unless your project has explicitly approved that workflow.
Read entity metadata
Use svi.admin.entity_types when your code needs field definitions or type metadata before it
creates or updates documents.
entity_type = svi.admin.entity_types.get(name="<your-entity-type>")
# Writable fields only; pass writable_only=False for every field, including read-only ones.
fields = svi.admin.entity_types.fields(name="<your-entity-type>")
print(entity_type)
print(sorted(fields.names())[:20])
Why this matters:
- Visual Investigator fields use service-defined names and constraints.
- Reading metadata first keeps document-creation code from guessing at them.
List summaries and delete a type
list_summaries() is the cheap listing. One request returns one compact record per type, carrying
the identity, the storage and indexing flags and the field names, but no field definitions.
for summary in svi.admin.entity_types.list_summaries():
print(summary.id, summary.name, summary.mode, summary.indexed_for_search, summary.field_names)
delete() hard-deletes a type by name= or entity_type_id= (exactly one), together with every
document of that type. It leaves the SAND search type and the access rules in place. Remove the
search type separately, or a later re-create of the same name fails.
svi.admin.entity_types.delete(name="<your-throwaway-entity-type>")
svi.admin.search_types.delete(name="<your-throwaway-entity-type>")
Child fields and image categories
Child field definitions come from the service. Image categories are a property of the entity type record, so fetch the record first:
child_fields = svi.admin.entity_types.child_fields(
parent_name="<your-parent-entity-type>",
child_name="<your-child-entity-type>",
)
print(sorted(child_fields.names())[:20])
entity_type = svi.admin.entity_types.get(name="<your-entity-type>")
if entity_type is not None:
print(sorted(entity_type.image_categories))
A child type carries its own image categories, so read them from the child's record. The same catalog answers which codes a reference-data field accepts:
child_type = svi.admin.entity_types.get(name="<your-child-entity-type>")
if child_type is not None:
for name, category in child_type.image_categories.items():
print(name, category.required, category.allow_multiple)
field = child_fields["<your-reference-data-field>"]
print(field.constraining_list_name)
print([item.code for item in field.resolve_reference_options()])
The field's constraining_list_name is the reference list behind it. svi.admin.reference_lists.get(...)
returns a record, not the items. Read the codes with record.items.list(). record.items is a
manager, so iterating it directly fails.
Reconstruct and hydrate metadata-backed models
from sasvi import BaseVIEntity
class TypedEntity(BaseVIEntity):
first_field: str | None = None
second_field: str | None = None
entity_type = svi.admin.entity_types.get(name="<your-entity-type>")
if entity_type is not None:
rebuilt = svi.admin.entity_types.reconstruct(entity_type_id=entity_type.id)
typed = svi.admin.entity_types.hydrate(
TypedEntity,
{"first_field": "value-1", "second_field": "value-2"},
)
print(rebuilt)
print(typed)
Async metadata helpers
async def load_entity_type(svi):
entity_type = await svi.admin.entity_types.get_async(name="<your-entity-type>")
if entity_type is None:
return None
return await svi.admin.entity_types.reconstruct_async(entity_type_id=entity_type.id)
Relationship types and search types
Use these services when you need lookup metadata that shapes relationships or SAND search type configuration.
relationship_types = svi.admin.relationship_types.list()
search_types = svi.admin.search_types.list()
print(relationship_types[:3])
print(search_types[:3])
search_types.list() reads one page of 20. Use list_all() when you need every search type:
every_search_type = svi.admin.search_types.list_all()
If you already know the lookup key, fetch one exact record:
relationship_type = svi.admin.relationship_types.get(
qualified_name="<your-relationship-qualified-name>"
)
search_type = svi.admin.search_types.get(name="<your-search-type-name>")
print(relationship_type)
print(search_type)
Reference lists
Use svi.admin.reference_lists for mutable list records. update_metadata(...) is the only way to
change label, description, archived, max_code_length or alphabetical_sort. Assigning to
one of them raises AttributeError and names the method to use, so a field never changes in memory
without reaching the server:
reference_list = svi.admin.reference_lists.get(name="<your-reference-list-name>")
if reference_list is not None:
reference_list.update_metadata(
description="Used by this deployment",
archived=False,
)
Inspect items before you remove or reorder them:
reference_list = svi.admin.reference_lists.get(name="<your-reference-list-name>")
if reference_list is not None:
items = reference_list.items.list()
print([(item.code, item.label) for item in items])
if items:
reference_list.items.remove(code=items[0].code)
reference_list.items.replace(reference_list.items.list())
Create normal reference lists with simple strings, mappings, or ReferenceListItemInput; you do
not need to provide item indexes:
from sasvi import ReferenceListItemInput
created = svi.admin.reference_lists.create(
name="<new-reference-list-name>",
label="Analyst-facing list",
alphabetical_sort=False,
items=[
ReferenceListItemInput(code="HIGH", label="High Risk"),
{"code": "MEDIUM", "label": "Medium Risk"},
"UNKNOWN",
],
)
Cascading reference data
svi.admin.reference_lists covers normal /svi-datahub/admin/lists reference lists. Visual
Investigator cascading reference-data hierarchies are separate objects served from
/svi-datahub/admin/cascadingData, which is not part of the generated public Data Hub API surface
modeled by the SDK. The SDK therefore does not expose first-class hierarchy create/read/update
helpers on reference_lists.
Entity field metadata still exposes the cascading reference-data filter names so you can identify fields that are driven by hierarchical/cascading reference data:
entity_type = svi.admin.entity_types.get(name="<your-entity-type>")
if entity_type is not None:
country = entity_type.field("country")
if country is not None:
print(country.constraining_list_name)
print(country.cascading_reference_data_filter_by_field)
print(country.cascading_reference_data_filter_by_code)
For low-level authenticated requests to cascading-data endpoints, use svi.custom; see
Custom endpoint requests and the custom cascading-data example notebook.
Create a reference list
A reference list is flat. Nesting belongs to cascading reference data, which is a different object and a different endpoint (see the section above).
created = svi.admin.reference_lists.create(
name="<new-reference-list-name>",
label="Analyst-facing list",
description="Values used by this deployment",
items=[
{"code": "AMER", "label": "Americas"},
{"code": "EMEA", "label": "Europe, Middle East and Africa"},
{"code": "APAC", "label": "Asia Pacific"},
],
)
print(created.name)
For flat lists, the convenience helpers avoid writing the full item payload by hand:
risk_levels = svi.admin.reference_lists.create_from_values(
"risk_levels",
["High Risk", "Medium Risk", "Low Risk"],
label="Risk Levels",
code_strategy="upper_slug",
alphabetical_sort=False,
)
print(risk_levels.to_lookup())
# {"HIGH_RISK": "High Risk", "MEDIUM_RISK": "Medium Risk", "LOW_RISK": "Low Risk"}
Use create_from_mapping(...) when you already know the deployment codes:
status_list = svi.admin.reference_lists.create_from_mapping(
"case_status",
{
"OPEN": "Open",
"IN_REVIEW": "In Review",
"CLOSED": "Closed",
},
label="Case Status",
alphabetical_sort=False,
)
Both helpers populate localizedLabels with locale="en-US" by default. Pass
locale=None when you only want the locale-neutral labels.
You can also use an existing list to validate values before you import them:
status_list = svi.admin.reference_lists.get(name="case_status")
if status_list is not None:
result = status_list.validate_values(["OPEN", "closed", "UNKNOWN"], case_sensitive=False)
if not result.valid:
print(result.to_dict())
Service-shaped admin domains
Most svi.admin subdomains share one shape:
list()on nearly all of them, which reads one pagelist_all()on the paged ones, which reads every pageget(...)on mostcreate(...),update(...)anddelete(...)where the service allows writes- a service-specific extra here and there, such as
test_connection()ondata_stores,publish()onsolutions, orexport_package()onalerts_package
Queues, domains, and strategies
queues = svi.admin.queues.list(limit=5)
domains = svi.admin.domains.list(limit=5)
strategies = svi.admin.strategies.list(limit=5)
print(queues)
print(domains)
print(strategies)
list() reads one page. When you pass neither start nor limit, the server picks the page
size, which is 10 rows for these services. If the server reports more rows than the page holds,
list() logs one WARNING under the sasvi logger, for example
alert queues: returned 10 of 37; use list_all() to read them all. list_all() pages to the end:
every_queue = svi.admin.queues.list_all()
first_fifty = svi.admin.domains.list_all(max_items=50)
small_pages = svi.admin.routing_rules.list_all(
batch_size=25, filter_="eq(domainId,'<your-domain-id>')"
)
list_all() and list_all_async() exist on queues, domains, alert_dispositions,
triage_definitions, routing_rules, enrichment_fields, scenario_tags, search_types,
strategies, logic_expressions and suppressed_scenarios. They raise
IncompleteListingError when the server stops advancing, and the error carries the offset to
resume from. strategies.list_all() also still takes limit as an older name for the page size.
Create and update take a typed input (spec=) or a raw payload (body=), never both. The
inputs are frozen dataclasses named after the object; every field maps to the same-named
attribute of the SAS representation and None fields are left unset:
import dataclasses
from sasvi.admin import QueueInput
queue = svi.admin.queues.create(
spec=QueueInput(queue_name="Fraud review", domain_id="<your-domain-id>", queue_priority=5)
)
# Read-modify-write: rebuild the input from the record, change one field, resend.
# `if_match=current.etag` makes the PUT fail if someone edited the queue in between.
current = svi.admin.queues.get(queue_id=queue.id)
svi.admin.queues.update(
queue_id=queue.id,
spec=dataclasses.replace(QueueInput.from_record(current), queue_priority=1),
if_match=current.etag,
)
get on queues, domains, strategies, alert dispositions, logic expressions, triage
definitions, routing rules, enrichment fields and scenario tags keeps the response ETag on the
record as record.etag. Pass it back as update(..., if_match=record.etag) to guard the whole
read-modify-write. strategies.update takes the same if_match and force and runs the same
check; whether the tenant itself honours If-Match on /strategies has not been verified live.
The alert service does not enforce the header. It sends an ETag on these reads and then accepts a
PUT whose If-Match names an older one (verified on a VI tenant, 2026-09-18). So the SDK checks it:
before the PUT it reads the record's current ETag, and when that differs from if_match it raises
AdminConflictError and writes nothing. Fetch the record again, reapply the edit and retry.
- The check is not atomic. An edit that lands between the SDK's read and its PUT is still overwritten. It stops the common case, an update prepared against a record read minutes ago.
- The ETag follows the record's
modifiedTimeStamp. An update that writes identical content leaves both unchanged. - With no
if_match,updatereads the current ETag just before the PUT and sends it. That costs one GET and only covers the time between those two requests. force=Trueskips the check, sends noIf-Matchand logs a WARNING. It wins overif_match.- When the server sends no
ETag, the SDK cannot check the caller's value. It sends it as given and logs a WARNING. With noif_matcheither, the update goes out unguarded and the SDK logsserver returned no ETag; update is unguarded. - A service that does answer 412 still raises
AdminConflictError, withstatus_code=412.
svi.admin.search_types.update needs If-Match, because SAND marks the header required. It reads
the ETag with a get when you pass none, and search_types.get keeps it on record.etag.
svi.admin.synonyms.add and remove cannot be guarded: they read the whole list and replace it,
and the SAND spec declares no precondition on the replace. Keep synonym edits to one writer at a
time.
An admin write that sends an ETag (if_match=) is a conditional PUT or DELETE.
The SDK does not resend it after a failure that leaves the outcome unknown, or
after a 5xx, because the resend would carry the old ETag and report a 412 for a
write that went through. A PUT without an ETag is still resent. When a write
raises NetworkError or DeadlineExceededError with outcome_unknown=True,
get the record again and check the field before you resend.
outcome_unknown=False means the request never reached the server. See
Performance.
The same shape exists for DomainInput, StrategyInput, AlertDispositionInput,
TriageDefinitionInput, RoutingRuleInput (which nests LogicExpressionInput) and
EnrichmentFieldInput. svi.admin.data_stores and svi.admin.search_types still take body=
only. Their payloads carry nested connection and SAND type schemas that need builders of their
own. data_stores.get keeps the ETag too, and data_stores.update runs the same if_match
check with the same force.
alert_dispositions.create needs alert_disposition_resolution_code, such as PRODUCTIVE,
NON_PRODUCTIVE or INDETERMINATE. The service requires it, and the SDK refuses a typed spec
without it rather than choose one, because the code decides how alerts closed with that
disposition are reported.
The service checks a disposition's modifiedTimeStamp as a version on every update: it refuses a
PUT whose body lacks the record's current stamp, even with force=True.
alert_dispositions.update(spec=AlertDispositionInput(...)) reads the disposition first and
copies its modifiedTimeStamp, creationTimeStamp, createdBy and modifiedBy into the body,
so you never pass them. A typed update replaces the record, so give every field you want to keep.
- When the disposition changed between that read and the
PUT, the service refuses the stamp with a 400. The SDK reads the record again, sees that the stamp moved and raisesAdminConflictError. It does not resend with the new stamp, because that would overwrite the other edit. Fetch the record, reapply your edit and retry. - A 400 for any other reason stays an
AdminOperationError. - Pass
if_match=record.etagfrom your owngetto cover the time since you read it. The SDK compares it with the ETag of its read before sending anything. force=Trueskips that ETag check and sends noIf-Match, but the body still carries the stamp the SDK just read.body=is sent as is, so a raw body must carry the stamp itself.
alert_dispositions.delete is a logical delete. The disposition stays in list() with
logical_delete_flag set, and it keeps blocking the delete of the queue its reroute_queue_id
names. To free that queue, update the disposition without a reroute_queue_id before you delete
it. Deleting a domain that still owns queues, or a queue a disposition still reroutes to, is
refused by the server and raises AdminOperationError; the SDK runs no referential pre-check.
Strategy reads: one strategy, totals, scenarios, queue metrics
strategy = svi.admin.strategies.get(strategy_id="<your-strategy-id>")
if strategy is None:
raise SystemExit("no such strategy")
print(strategy.strategy_name, strategy.strategy_status, strategy.etag)
get returns None for an unknown id and raises AdminOperationError for any other failure.
list() returns rows without the total. list_page() returns the same page with the count the
server reports, and domains.strategies_page() does the same for one domain:
page = svi.admin.strategies.list_page(limit=25)
print(f"{len(page.items)} of {page.total} strategies")
in_domain = svi.admin.domains.strategies_page(domain_id="<your-domain-id>", limit=25)
print(f"{len(in_domain.items)} of {in_domain.total} strategies in the domain")
scenarios() returns one page of ScenarioRecord rows, with the same items and total:
scenarios = svi.admin.strategies.scenarios(strategy_id="<your-strategy-id>", limit=50)
for scenario in scenarios.items:
print(scenario.scenario_id, scenario.scenario_name, scenario.version)
A ScenarioRecord has scenario_id, scenario_name, scenario_description, strategy_id and
version. The tenants checked so far send no description, so expect None there. Any other key
the service sends is in scenario.raw_dict().
queue_metrics() returns one QueueMetricsRecord per queue of the strategy:
from datetime import datetime, timedelta, timezone
for queue in svi.admin.strategies.queue_metrics(strategy_id="<your-strategy-id>"):
print(queue.queue_name, queue.active_alerts, queue.median_age_hours, queue.oldest_age_hours)
# The day as an analyst in UTC-4 sees it: pass the instant their day starts.
local_midnight = datetime(2026, 9, 30, tzinfo=timezone(timedelta(hours=-4)))
svi.admin.strategies.queue_metrics(strategy_id="<your-strategy-id>", today=local_midnight)
todayis the day the counts are for. Leave it out, or pass adate, for midnight UTC of that day. Pass an awaredatetimefor the start of the day in another time zone. A naivedatetimeraisesAdminOperationErrorbefore any request. A string is sent as given.- The counts are
active_alerts,num_serviceable,high_count,med_count,low_count,none_countandunscored_count.median_scoreis the median alert score. median_age_hoursandoldest_age_hoursare in hours. The service calls themmedian_ageandoldest.
An unknown strategy id is not an error on these two reads. scenarios() returns an empty page and
queue_metrics() returns [], because the service answers 200 for both.
Each of these methods has an _async twin.
Data stores, icons, solutions, and transaction types
default_store = svi.admin.data_stores.default()
database_types = svi.admin.data_stores.supported_database_types()
icons = svi.admin.icons.list()
transaction_types = svi.admin.transaction_types.list()
print(default_store)
print(database_types)
print(icons[:3])
print(transaction_types[:3])
Alert metadata, alerting event metadata, alert actions, and alerts package
alert_fields = svi.admin.alert_metadata.fields()
event_fields = svi.admin.alerting_event_metadata.fields()
package = svi.admin.alerts_package.export_package()
print(alert_fields)
print(event_fields)
print(package.byte_size, package.sha256)
package.save_zip("alerts-config.zip")
export_package() returns an AlertsConfigurationPackage, the same type export_bundle() puts in
bundle.alerts. import_package(body=...) takes that package, the ZIP bytes, or an open binary
file; a mapping is refused before anything is sent.
svi.admin.alert_actions.perform(...) is the write-side helper when you need to invoke an
alert action from the config domain. action_type is the last segment of the request path and
is one of "ASSIGNMENT", "CHECKIN", "CHECKOUT" or "REACTIVATE". body is the action
request collection, as the generated model or as a mapping in wire form.
svi.admin.alert_actions.perform(
action_type="CHECKOUT",
body={"items": [{"alertIds": [alert_id], "actionType": "CHECKOUT"}]},
)
svi.admin.transaction_types.reconstruct(transaction_type_id=...) rebuilds a transaction
type's field metadata from its database table, like entity_types.reconstruct does for an
entity type. The server does not update other services to match.
Suppressed scenarios and logic expressions
A suppressed scenario mutes one scenario for one entity until time_to_restore. A logic
expression is one condition of an alert routing rule. Both live under svi.admin with the same
list / get / create / delete shape, and logic expressions add update.
from datetime import datetime, timedelta, timezone
from sasvi.admin import LogicExpressionInput, SuppressedScenarioInput
suppressed = svi.admin.suppressed_scenarios.list(limit=20)
suppression = svi.admin.suppressed_scenarios.create(
spec=SuppressedScenarioInput(
domain_id="<your-domain-id>",
scenario_id="<your-scenario-id>",
scenario_fired_entity_id="<your-entity-id>",
scenario_fired_entity_type="<your-entity-type>",
time_to_restore=datetime.now(timezone.utc) + timedelta(days=7),
suppression_comment="known false positive",
)
)
svi.admin.suppressed_scenarios.delete(suppressed_scenario_id=suppression.id)
expressions = svi.admin.logic_expressions.list(filter_="eq(routingRuleId,'<your-rule-id>')")
expression = svi.admin.logic_expressions.create(
spec=LogicExpressionInput(
routing_rule_id="<your-rule-id>",
property_name="currentScore",
condition_code="EQ",
value_text="90",
)
)
svi.admin.logic_expressions.update(
logic_expression_id=expression.id,
spec=LogicExpressionInput(
routing_rule_id="<your-rule-id>",
property_name="currentScore",
condition_code="EQ",
value_text="95",
),
)
list_all() pages until the collection is exhausted. Suppressed scenarios have no update
because the alert service publishes none, so delete and re-create instead. time_to_restore must
be an aware datetime, or a string the server already formatted.
Search indexing
svi.admin.indexing starts search-index jobs and manages the SAND index generations behind them.
The re-index recipe from the SAND specification has three steps. Create an unsearchable generation
per type, load it, then promote it.
indexing = svi.admin.indexing
indexing.ensure_indices(searchable=False) # 1. new generation per type
job = indexing.start_full() # 2. load it (SEARCH_INDEX_LOADER job)
print(job.id, job.status, [task.object_name for task in job.tasks])
# ... wait for the job on the VI admin Jobs page ...
indexing.make_searchable() # 3. switch searches over, drop old generations
Scope a job when you know what changed:
from datetime import datetime, timedelta, timezone
indexing.start_incremental(
since=datetime.now(timezone.utc) - timedelta(hours=1),
entities=["<your-entity-type>"],
relationships=[("<your-relationship-type>", "<your-from-entity-type>")],
)
indexing.start_for(entities=["<your-entity-type>"], index_associated_objects=False)
Read-only helpers:
print(indexing.index_name(type_name="<your-entity-type>")) # SearchIndex or None
print(indexing.format_version()) # IndexFormatVersion
status = indexing.refresh_configuration(status_only=True)
print(status.refresh_required, status.reindex_required)
refresh_configuration, make_searchable, ensure_indices and ensure_index take their own
timeout (default 300 s), because the client default is too short for them. A status-only refresh
compares every configured type against its index, which took 46 s on a mid-sized tenant, and
ensure_indices creates a generation per type, which outran the client default at 87 types.
Only ensure_index(type_name=...), make_searchable(type_name=...) and
refresh_configuration(type_name=...) narrow to a single type. ensure_indices always sweeps the
whole tenant, and takes searchable=, limit= (the cap on indices in the one response, default
1000) and timeout=. On a large tenant, raise timeout= or call ensure_index per type.
One thing is deliberately missing. No job status API is published. The datahub spec covers
POST /admin/asyncJobs only. Status and cancel live on the VI job monitor and indexer services,
which have no OpenAPI specification, so IndexingJob has no refresh(). Watch the Jobs page in
the VI admin UI instead. Index deletes (DELETE /admin/indices) stay raw-only on svi.api.sand.
See the re-index recipe.
Go further
- Need exact methods: Configuration API reference
- Need real names and ids first: Discover Your Environment
- Need background on VI service terms: Visual Investigator Vocabulary