Connecting to Celonis

[ ]:
#To get a copy of this notebook in your current working dirtectory, run:
from pycelonis import notebooks

The Celonis object

Import the get_celonis function and call it. This will return either an IBC object or a CPM4 object. Permissions are determined by the App/API key you use to log in! Set read_only to True if you want to make sure you can’t break anything.

[1]:
from pycelonis import get_celonis

celonis = get_celonis()
2019-10-08 12:01:08 - Login successful! Hello Simon Riezebos

(Optional) specify login details manually

By default pycelonis will get the login information from environment variables. See :meth:get_celonis for more details. You can also specify them manually.

[ ]:
login = {
    "celonis_url": "demo.eu-1.celonis.cloud",
    "api_token": "paste_here_your_api_token",
    #The following 2 lines are only necessary when connecting to CPM4.5, not for IBC:
    #"api_id": "paste_here_your_api_id",
    #"username": "paste_here_your_username",
}
celonis_manual = get_celonis(**login)

Working with (Celonis) objects in Jupyter Notebook

The object returned by get_celonis is your portal into celonis, press tab after ``c.`` to see the available methods and attributes.

[ ]:
celonis.

Objects in celonis can be found using their ID or (substring of) name. Press shift-tab inside the parentheses to see the signature and documentation of each function.

[3]:
analysis = celonis.analyses.find('117f7528-8504-4450-9fd6-8ebcf1749d18')
analysis
[3]:
<Analysis, id 117f7528-8504-4450-9fd6-8ebcf1749d18, name OTD Prediction Binary - Technical App (OAF) - Copy>

Objects can also be accessed directly with auto-complete using the .names[] or .ids[] property of a collection.

[ ]:
celonis.datamodels.names #[<-PRESS TAB HERE]

Advanced: access the API data of a Celonis object

Almost every object that represents an object in Celonis contains a .data property that shows the JSON data from the Celonis API. This data is automatically refreshed and if changes are made to this data, ``pycelonis`` tries to make the same changes in the object in Celonis.

[5]:
analysis.data
[5]:
{'permissions': ['MOVE_TO',
  'DELETE_WORKSPACE',
  'CREATE_WORKSPACE',
  'DELETE_ALL_WORKSPACES',
  'DELETE_ALL_ANALYSES',
  'EDIT_ALL_ANALYSES',
  'EDIT_ALL_WORKSPACES',
  'USE_ALL_ANALYSES',
  'CREATE_ANALYSES',
  'DELETE_ANALYSIS',
  'EDIT_WORKSPACE',
  'MANAGE_PERMISSIONS',
  'EXPORT_CONTENT',
  'USE_ANALYSIS',
  'EDIT_ANALYSIS'],
 'id': '117f7528-8504-4450-9fd6-8ebcf1749d18',
 'tenantId': None,
 'name': 'OTD Prediction Binary - Technical App (OAF) - Copy',
 'description': None,
 'deleted': False,
 'transportId': None,
 'lastPublishedDraftId': '7f82df02-b728-4ca3-acdf-1940dd7de7b0',
 'autoSaveId': '2e47dccc-8cbf-400d-8404-72e1f5298d0d',
 'processId': 'acb6313c-bba8-46fd-9637-24c7d5463746',
 'createDate': 1556264369787,
 'favourite': False,
 'contentId': None,
 'contentVersion': 0,
 'tags': [{'name': 'WillBeDeleted'}],
 'applicationId': '',
 'publicLink': False,
 'lastPublishedDate': 1564498481791,
 'lastPublishedUser': 'Simon',
 'objectId': '117f7528-8504-4450-9fd6-8ebcf1749d18',
 'publishedDraftId': '7f82df02-b728-4ca3-acdf-1940dd7de7b0',
 'folderId': '117f7528-8504-4450-9fd6-8ebcf1749d18',
 'parentObjectId': 'acb6313c-bba8-46fd-9637-24c7d5463746'}