Before you publish a version of a service, you must create a function for the service and debug the function to ensure that it can be stably executed. This topic describes how to invoke a function in a service of the LATEST version in the Function Compute console or by calling the API operation.
Prerequisites
In this example, the created service is named service and the created function is named function.
Invoke a function in a service of the LATEST version in the Function Compute console
Invoke a function in a service of the LATEST version by calling the API operation.
The t1881175.html#section_dhk_f7z_9gw operation can be called to invoke a function in a service of the LATEST version in the following scenarios:
- Invoke a function in a service of the LATEST version when version management is not
enabled
When no version information is specified, the system invokes the function in the service of the LATEST version by default. The request is in the following format:
POST /services/{serviceName}/functions/{functionName}/invocations
The following sample request is used:POST /services/{service}/functions/{function}/invocations
- Invoke a function in a service of the LATEST version by using the suffix of the specified
version
To enable the system to invoke a function in a service of the LATEST version, you can append
.LATEST
to the serviceName parameter in the request. The request is in the following format:POST /services/{serviceName}.LATEST/functions/{functionName}/invocations
The following sample request is used:POST /services/{service}.LATEST/functions/{function}/invocations