Topology Service
ucmdb_rest.topology.Topology(server)
Initialize the service with a reference to the main level UCMDB server
Source code in ucmdb_rest\topology.py
getChunk(res_id, index)
This method retrieves the values in each chunk (index).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
res_id
|
str
|
The temporary result identifier (queryResultId) from the initial call. |
required |
index
|
int
|
Which chunk to get. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Can be converted to a dictionary containing the CIs and relations. For example: { "cis": [ { "ucmdbId": "4fc4d26b423c52bd99c3586017fd55e7", "globalId": null, "type": "nt", "properties": { "display_label": "pue01vm0040" }, "attributesDisplayNames": null, "attributesQualifiers": null, "attributesType": null, "classDefinition": null, "displayLabel": null, "label": "Windows" }, { "ucmdbId": "4fe8814b30be8ca4aeedcf1e4323fa62", "globalId": null, "type": "nt", "properties": { "display_label": "pue01vm1278" }, "attributesDisplayNames": null, "attributesQualifiers": null, "attributesType": null, "classDefinition": null, "displayLabel": null, "label": "Windows" }, { "ucmdbId": "4fee7d96a41be2f48f7fd343e815b6de", "globalId": null, "type": "nt", "properties": { "display_label": "bra03pc78" }, "attributesDisplayNames": null, "attributesQualifiers": null, "attributesType": null, "classDefinition": null, "displayLabel": null, "label": "Windows" } ], "relations": [] } |
Source code in ucmdb_rest\topology.py
getChunkForPath(state, execution_id, chunk)
Retrieves a chunk of data for a specific path from the UCMDB server.
This method makes a POST request to the UCMDB server to retrieve a chunk of data for a specific path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
str
|
The path element ID. |
required |
execution_id
|
str
|
The ID of the view execution. |
required |
chunk
|
int
|
The number of the chunk to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Response object containing the requested chunk of data. |
Source code in ucmdb_rest\topology.py
get_all_view_results(view_name, chunkSize=10000)
Executes a view and automatically aggregates all paged chunks.
This is the recommended method for retrieving large views. It handles the initial request and iterates through all subsequent chunks to provide a single, unified result set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
The name of the view in UCMDB. |
required |
chunkSize
|
int
|
The number of CIs to retrieve per API call. Default is 10000. |
10000
|
Returns:
| Type | Description |
|---|---|
dict
|
A combined dictionary containing 'cis' and 'relations' lists. |
Source code in ucmdb_rest\topology.py
queryCIs(query)
Retrieves the result of a query defined in UCMDB via a REST API POST call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
dict
|
JSON describing the query. For example: { "nodes": [ { "type": "node", "queryIdentifier": "node", "visible": "true", "includeSubtypes": "true", "layout": ["display_label"], "attributeConditions": [], "linkConditions": [], "ids": [] } ], "relations": [] } |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Can be converted to a dictionary containing 2 entries, a list of CIs (dictionaries) and a list of relations (also dictionaries). For example: { "cis": [], "relations": [] } |
Source code in ucmdb_rest\topology.py
runView(view, includeEmptyLayout=False, chunkSize=10000)
Retrieves the result of a view defined in UCMDB via a REST API POST call
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
str
|
Name of a view on the UCMDB server. |
required |
includeEmptyLayout
|
bool
|
Should empty layouts be shown? Default is False. |
False
|
chunkSize
|
int
|
The max number of nodes to return in each chunk. |
10000
|
Returns:
| Type | Description |
|---|---|
Response
|
Can be converted to a dictionary contains 2 entries, CIs and Relations, each of which is a list of dictionaries. For example: { "cis": [], "relations": [] } |