# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved. import splunk.rest as rest def fetch_services(session_key): path = rest.makeSplunkdUri() + 'servicesNS/nobody/SA-ITOA/itoa_interface/service' fields = [ 'title', '_key', 'kpis.title', 'kpis._key', 'kpis.type', 'kpis.unit', 'kpis.search_time_series', 'kpis.search_alert_earliest' ] getargs = { 'fields': ','.join(fields), 'sort_key': 'identifying_name', 'sort_dir': 'asc' } response, content = rest.simpleRequest( path, method='GET', getargs=getargs, sessionKey=session_key, raiseAllErrors=False ) return {'response': response, 'content': content}