Executing Cloud Functions Programmatically

Executing Cloud Functions Programmatically

First introduced in Backend Services JavaScript SDK version 1.6.11.
With previous SDK versions, use a RESTful call.

You can execute a Cloud Function from your code using the invokeCloudFunction SDK method. It transparently makes the necessary HTTP request to the Cloud Function's specific endpoint.

The following example illustrates how to call a Cloud Function with query string parameters. It takes two arguments: cloudFunctionName is the function name and params is an object that contains the query string parameters, but can also contain other specifics such as HTTP method, headers, and so on.

var cloudFunctionName = "ConvertCurrency";

var params = {};
params.queryStringParams = {};
params.queryStringParams.from = "USD";
params.queryStringParams.to = "EUR";
params.queryStringParams.amount = 153;

everliveApp.businessLogic.invokeCloudFunction(cloudFunctionName, params).then(function (data) {
  alert(JSON.stringify(data));
}, function (err) {
  alert(JSON.stringify(err));
});

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.