The build_id() method generates an ID string from the specified object name and the resource URI path defined in the model.
resId = build_id( name, namespace, owner )
|
name |
String |
Entity name. |
|
namespace |
String |
Entity namespace, or application name. |
|
owner |
String |
Entity owner. |
|
String |
Hierarchical URI path to the requested entity in the REST API. |
from splunk.models.base import SplunkRESTModel
class MyAppModel(SplunkRESTModel):
try:
id = MyAppModel.build_id(name='newsearch', namespace='search', owner='admin')
except:
raise
Without build_id():
form_content[key] = EventType.get('/servicesNS/%s/%s/saved/eventtypes/%s' %\
(user, 'webintelligence', key))
Alternative using build_id():
et = Eventtype.build_id(key, 'webintelligence', user) form_content[key] = EventType.get(et)