The getLogicService API creates an instance of logic service that is configured in the Kony Fabric portal. logicClient = KNYMobileFabric.getLogicService(serviceName)
The invokeOperation API invokes the backend operation using the object of logic service. The invoke operation function is as follows:
// To access the operations defined in the KonyFabric portal for the logic service: logicClient.invokeOperation(serviceName, path, HttpMethodType, headers, data, SuccessCB, FailureCB) //Where, serviceName = < your - service - name > ; path = < path as defined in KonyFabric > ; HttpMethodType = The type of call like "POST", "PUT", "GET", "DELETE" header = the header like { "testget": "test" } data = the data field like { "LastName": "LNamePOST" } SuccessCB = Success CallBack FailureCB = Failure CallBack
// Sample code to fetch the logic service details var response = konymbaas.getLogicService("mailapp"); alert("Response is :" + response.getLogicServiceUrl()); response.invokeOperation("mailapp", "/api/v1/contact", "POST", { "test": "test" }, { "LastName": "LNamePOST" }, function(res) { alert("successfully fetched logic service" + JSON.stringify(res)); }, function(res) { alert("error occurred in fetching logic service" + JSON.stringify(res)); });
Last updated on : 13 June, 2023 | Copyright © 2020 Kony, Inc. All rights reserved. |