cherwellapi Routers

routers Base Class

class cherwellapi.routers.CherwellRouter(url, headers, user, password, client_id, ssl_verify, token_expire_minutes=18, timeout=5, maxattempts=3)[source]

Bases: object

Base class for Cherwell router classes

load_token()[source]
refresh_token()[source]

Relationships Router

Cherwell Relationships Router

class cherwellapi.routers.relationships.RelationshipsRouter(url, headers, user, password, client_id, ssl_verify)[source]

Bases: CherwellRouter

Class for interacting with Cherwell relationship functions

Get related business objects given a business object, record and relationship

get_relationships(ci=None, ci_id=None, relationship_name=None)[source]

Search Router

Cherwell Search Router

class cherwellapi.routers.search.SearchRouter(url, headers, user, password, client_id, ssl_verify)[source]

Bases: CherwellRouter

Class for interacting with Cherwell search functions

get_search_results(search)[source]

Get results of a Cherwell search

Parameters:

search (dict) – A dictionary containing the search parameters to pass to cherwell

Returns:

List of dicts containing business object data

Return type:

list[dict]

Translation Router

The Cherwell translation router is a specialized router that allows common names to be used for business objects, records, fields, etc in a way that remains performant.

The first time a resource is queried the results are stored in the router allowing repeat queries within the same session to use cached data for rapid retrieval.

class cherwellapi.routers.translation.TranslationRouter(url, headers, user, password, client_id, ssl_verify)[source]

Bases: CherwellRouter

ci_index = None

Class translating Cherwell objects/ids into friendly names and vice versa

get_ci_id(ci)[source]

Returns the business object id of a configuration item. Either the Name or Display Name may be used. Name is searched first by default.

Parameters:

ci (str) – Name or Display name of the CI

get_field(ci=None, ci_id=None, field=None)[source]

Returns the field id of a field. Either the CI name, display name or ID AND the field name or display name must be provided.

get_fields(ci=None, ci_id=None, field_list=None)[source]

Returns a dictinary of fields and their field IDs. Either the CI name, display name or ID AND a list of field names or display names must be provided. Dictionary is returned in the format {field (display)name: field ID}