If you want to execute a Cloud Function from you code, you need to make an HTTP request to its specific endpoint URL. This URL is generated like this:
- app-id—the App ID of your app
- function-name—the name of the Cloud Function that you want to execute
- parameter1=value1¶meter2=value2&...parameterN=valueN—optional URL parameters passed to the Cloud Function
When making the HTTP request, you can use any HTTP method you like—GET, POST, DELETE, and so on. The result will be the same unless your Cloud Function implements branching depending on the HTTP method.
You can include any headers that you need with the HTTP request. The headers, along with the HTTP request body, are available to your Cloud Function during execution and are a handy way to send parameters. Do not forget to set the
Content-Type header properly if you are using the request body to send data. Accessing URL parameters and header data is described in Defining Cloud Functions.