Note: This Tutorial relates to version 1.x of openape.js
you can use the OpenAPE Java script client to communicate between your application and the OpenAPE server. By doing so you can get all context information that you require to adjust your application to the user's needs and preferences
In order to make use of it you need an OpenAPE user account. Usually, you create an account via the OpenAPE web page. However, it is also possible to create a new account with openape.js. Therefore call the function createUser(username, email, password, serverurl). The last parameter is optional and must only be set if you want to use an OpenAPE server other than http://openape.gpii.eu
Making use of user context data is the simple case. In this case the information contained in in a user context are interpreted by your application and it adjusts the user interface on its own.
Unless a user context was not created by your client itself, the client usually does not know the Id of the relevant user context. In order to get the Id you can request all user contexts of a user by making use of the function getUserContextList()
In a next step you select a user context and adjust your application.
Finally, if the user changes some settings in the user interface that are relevant to other applications, you might adjust the user context. Therefore you use the function updateUserContext(userContextId, userContext).
this is the more advanced case in which the application does not decide on its own about all the adjustments. Instead it requests some recommendations on user interface settings and resources from the OpenAPE server.
<script> var username = "your username"; var password = "your password"; openape.initializeLibrary(userName, password); var userContextList = openape.getUserContextList(); // select a user context according to your own criteria. var userContext = openape.getUserContext(userId); // upload other context information as needed. var equipmentContext = myApp.getEquipmentContextInformation(); var equipmentContextId = openape.createEquipmentContext(equipmentContext); var eenvironmentContext = myApp.getEnvironmentContextInformation(); var environmentContextId = openape.createEnvironmentContext(environmentContext); var taskContext = myApp.gettaskContextInformation(); var taskContextId = openape.createtaskContext(taskContext); var listing = openape.createListing(); // select the relevant resources // make use of the resources </script>