Celonis Basics¶
# To get a copy of this notebook in your current working dirtectory, run:
from pycelonis.notebooks import api_tutorial
1. The Celonis object¶
Import the get_celonis function and call it. This will return a Celonis object.
Permissions are determined by the App/API key you use!
Set read_only to True if you want to make sure you can't break anything.
from pycelonis import get_celonis
celonis = get_celonis()
2020-12-17 13:14:38 - pycelonis: Login successful! Hello John Doe
(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.
celonis_manual = get_celonis(
url="demo.eu-1.celonis.cloud",
api_token="paste_here_your_api_token"
)
2. Working with (Celonis) objects in Jupyter Notebook¶
The object returned by get_celonis is your portal into celonis, add a . behind celonis press tab after celonis. 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.
analysis = celonis.analyses.find('1d4cde8e-a7ab-4b0c-92de-39f2a3848801')
analysis
<Analysis, id 1d4cde8e-a7ab-4b0c-92de-39f2a3848801, name P2P - On-Time Delivery>
Objects can also be accessed directly with auto-complete using the .names[] or .ids[] property of a collection.
celonis.datamodels.names #[<-PRESS TAB HERE]
3. 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.
analysis.data
{'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'}