Skip to content

Service Items

A service item is a running instance of a service — what a consumer has requested and what the service owner delivers. Service items are the central object in most automation workflows.

Accessed via client.service_items.

States

Runtime state

runtime_state Description
REQUESTED Requested by consumer, not yet in service
IN_SERVICE Active and being used
DECOMMISSIONED Decommissioned, no longer active

Change state

Reflects the aggregate state of all open change instances on the item:

change_state Description
CHANGES_PENDING At least one change instance is waiting for processing
CHANGES_APPROVED At least one is approved (none pending, errored, or rejected)
CHANGES_ERROR At least one change instance encountered an error
CHANGES_REJECTED At least one is rejected (none errored)
ALL_CHANGES_COMPLETED All change instances have finished

Model properties

Property Type Description
id int Service item ID
name str Service item name
runtime_state str Current runtime state
change_state str Aggregate change state
service_id int Associated service ID
service_name str Associated service name
application_id int Associated application ID
application_name str Associated application name
consumer_team_id int Consumer team ID
consumer_team_name str Consumer team name
service_owner_team_id int Service owner team ID
service_owner_team_name str Service owner team name
created datetime Creation timestamp
modified datetime Last modified timestamp

Methods

list(exclude_decommissioned=True, **filters)

Returns a lazy generator that iterates all service items one page at a time. By default, DECOMMISSIONED items are excluded — pass exclude_decommissioned=False to include them.

Filters:

Filter Type Description
name str Exact name match
runtime_state str Filter by runtime state (REQUESTED, IN_SERVICE, DECOMMISSIONED)
change_state str Filter by change state
service_id int Filter by service ID
service_name str Exact service name match
application_id int Filter by application ID
application_name str Exact application name match
application_name_contains str Partial application name match
consumer_team_id int Filter by consumer team
service_owner_id int Filter by service owner team
service_owner_team_id int Filter by service owner team ID
declaration str Exact match on the service item's declaration JSON
declaration_contains str Partial match on declaration
declaration_regex str Regex match on declaration
start_date str Filter by creation date (ISO format, inclusive lower bound)
end_date str Filter by creation date (ISO format, inclusive upper bound)
ordering str Sort field — prefix with - for descending (e.g. name, -modified)
# All active items (decommissioned excluded by default)
for item in client.service_items.list():
    print(item.name, item.runtime_state)

# Include decommissioned items
for item in client.service_items.list(exclude_decommissioned=False):
    print(item.name, item.runtime_state)

# Only items waiting to be provisioned
for item in client.service_items.list(runtime_state="REQUESTED"):
    print(item.name, item.service_name)

filter(**filters)

Same as list() but returns all results as a list. Accepts the same filters. Use when you need the count or random access.

# All IN_SERVICE items for a specific service, sorted by name
items = client.service_items.filter(
    service_id=45,
    runtime_state="IN_SERVICE",
    ordering="name"
)
print(f"{len(items)} active items")

# Items whose application name contains "prod"
items = client.service_items.filter(application_name_contains="prod")

# Items with pending changes for a consumer team
items = client.service_items.filter(
    consumer_team_id=5,
    change_state="CHANGES_PENDING"
)

get(id)

Retrieves a single service item by ID. Raises NetorcaNotFoundError if not found.

Service items have convenience methods to check their state without string comparisons: - is_requested()True if runtime_state == "REQUESTED" - is_in_service()True if runtime_state == "IN_SERVICE" - is_decommissioned()True if runtime_state == "DECOMMISSIONED"

item = client.service_items.get(123)

print(item.id)
print(item.name)
print(item.runtime_state)
print(item.change_state)
print(item.service_name)
print(item.application_name)
print(item.consumer_team_name)
print(item.service_owner_team_name)
print(item.created)
print(item.modified)

# State checks
if item.is_requested():
    print("Waiting to be provisioned")
elif item.is_in_service():
    print("Currently active")
elif item.is_decommissioned():
    print("No longer active")

# Raw API data
raw = item.to_dict()

by_service(service_id, **filters)

Shortcut to get all service items belonging to a specific service. Equivalent to filter(service_id=service_id, **filters). Returns a list.

Accepts all the same filters as filter().

# All items for a service
items = client.service_items.by_service(service_id=45)

# Only IN_SERVICE items for a service, sorted by name
items = client.service_items.by_service(service_id=45, runtime_state="IN_SERVICE", ordering="name")

by_application(application_id, **filters)

Shortcut to get all service items belonging to a specific application. Equivalent to filter(application_id=application_id, **filters). Returns a list.

items = client.service_items.by_application(application_id=10)

# Only active items in this application
items = client.service_items.by_application(application_id=10, runtime_state="IN_SERVICE")

in_service(**filters)

Returns all items with runtime_state="IN_SERVICE" as a list. Additional filters can be passed to narrow the results.

# All active items across all services
items = client.service_items.in_service()

# Active items for a specific service
items = client.service_items.in_service(service_id=45)

# Active items for a specific consumer team
items = client.service_items.in_service(consumer_team_id=5)

requested(**filters)

Returns all items with runtime_state="REQUESTED" as a list. These are items that have been ordered but not yet fulfilled.

# Everything waiting to be provisioned
items = client.service_items.requested()

# Waiting items for a specific service
items = client.service_items.requested(service_id=45)

get_dependant(**filters)

Returns service items that have a declared dependency on other service items. Useful for understanding provisioning order when services depend on each other. Returns a list of raw dicts.

dependants = client.service_items.get_dependant()
for dep in dependants:
    print(dep)