"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
}
] On the trigger list page of a function, click HTTP trigger and view the suffix of the value of Trigger URL. The suffix is the trigger identifier, which is in Function name-Version number format. As shown in the following figure, myhandlerxxxx-$latest is the HTTP trigger identifier, in which myhandlerxxxx is the function name, and $latest is the version number.

import { cloudFunction } from '@kit.CloudFoundationKit';
import { BusinessError } from '@kit.BasicServicesKit';cloudFunction.call({
name: 'myhandlerxxxx',
version: '$latest', // If no version number is specified, the default value $latest is used.
timeout: 10 * 1000, // Timeout interval, in milliseconds. The default interval is 70 x 1000 milliseconds.
data: {
param1: 'val1',
param2: 'val2'
}
}).then((value: cloudFunction.FunctionResult) => {
console.info(`Succeeded in calling the function, result: ${JSON.stringify(value.result)}`);
}).catch((err: BusinessError) => {
console.error(`Failed to call the function, Code: ${err.code}, message: ${err.message}`);
}) Or
cloudFunction.call({
name: 'myhandlerxxxx',
version: '$latest',
timeout: 10 * 1000,
data: {
param1: 'val1',
param2: 'val2'
}
}, (err: BusinessError, value: cloudFunction.FunctionResult) => {
if (err) {
console.error(`Failed to call the function, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in calling the function, result: ${JSON.stringify(value.result)}`);
})let returnValue = value.result;
value is the cloudFunction.FunctionResult object returned by the call() method in step 2. The return value is the result returned by the body of the cloud function. For example, during the function testing process, value.result is {"simple":"example"}.