Note
This API has been available since API level 11.
This API has been available since API level 11.
CIM is a service that adds AI logic to your web app, without actually modifying its source code. This makes your web app context-aware and therefore provide a better experience to your customers.
How does it work:
Before using the Service
Add necessary permissions (cim.release) in the appinfo.json file (see below)
NA
API level 11
Publishes data from the workflow to the app.
The data can be consumed by an app which has subscribed to it.
Name | Required | Type | Description |
---|---|---|---|
key | Required | String | Identifies the 'data-publish' node that is defined in the workflow. Note: Make sure that the key is associated with the relevant 'data-publish' node. |
subscribe | Required | Boolean | Subscribe for notifications when value changes. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details. |
subscribed | Required | Boolean | Indicates if subscribed to get notified when there is a change in value.
|
result | Required | Object: result | Contains the result. |
Name | Required | Type | Description |
---|---|---|---|
subscribed | Required | Boolean | Indicates if subscribed to get notified when there is a change in value.
|
result | Required | Object: result | Contains the result. |
Example scenario
// This API must be called within an app. Below is a sample app code snippet. Do not try to run the code directly from the terminal as it will fail.
function getDataFromWorkflow(){
var bridge = new WebOSServiceBridge();
var url = 'luna://com.webos.service.contextintentmgr/getDataFromWorkflow';
bridge.onservicecallback = callback;
function callback(msg){
var response = JSON.parse(msg);
console.log(response.returnValue);
}
var params = '{key: "6bb6c4ab.00e67c_d89eafda.fe87f" }';// Key generated in the data-publish node
bridge.call(url, params);
}
API level 11
Injects data from the app to the workflow.
Name | Required | Type | Description |
---|---|---|---|
key | Required | String | Identifies the 'data-inject' node that is defined in the workflow. Note: Make sure that the key is associated with the relevant 'data-inject' node. |
data | Required | String | The actual data that must be sent to the workflow. It must be a stringified object. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details. |
result | Required | Object: result | Contains the result. |
Example scenario
// This API must be called within an app. Below is a sample app code snippet. Do not try to run the code directly from the terminal as it will fail.
function injectDataToWorkflow(){
var bridge = new WebOSServiceBridge();
var url = 'luna://com.webos.service.contextintentmgr/injectDataToWorkflow';
bridge.onservicecallback = callback;
function callback(msg){
var response = JSON.parse(msg);
console.log(response.returnValue);
}
var params = '{
key: "6bb6c4ab.00e67c_128e776f.c57939", // Key generated in the data-inject node
data: <>
}';
bridge.call(url, params);
}
Contains the results.
Name | Required | Type | Description |
---|---|---|---|
data | Required | Object | Depending on the method:
|
Error Code | Error Text | Error Description |
---|---|---|
0 | Not a JSON data in the data-inject request. | The 'data-inject' request does not include JSON data. |
0 | Invalid call to API | Invalid call to API |
0 | Could not inject data | Could not inject the data. |
0 | Associated flow is disabled, calls to APIs does not work | This error is thrown when workflow is disabled. |
0 | Caller does not have permission for this API. | This error is thrown when the calling application does not include a 'data-inject' or 'data-publish' node with the specified key. |
Contents