api client for the i-doit cmdb JSON RPC API in python3
quite early state ...
from idoitapiclient import IdoitApiClient as idoit
url = 'https://demo.i-doit.com/src/jsonrpc.php'
auth = ('admin', 'admin')
apikey = 'c1ia5q'
# create instance
call = idoit(url, auth, apikey)
# build a dictionary with the needed params
params = {
"jsonrpc": "2.0",
"method": "cmdb.object.create",
"params": {
"type": "C__OBJTYPE__SERVER",
"title": "FancyName",
},
}
# call the generic request method
call.generic_request(params)
returns the (error)message from API
call.retrieve_object_id(name)
given name as string
method returns id as int or false if object is not found
❗ careful object ist deleted not archived ❗
call.delete_object_by_id(object_id)
given object_id as int
method returns True if object is deleted and false if object_id is not found