HttpTrigger Interface

Definition

HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request) { String name = request.getBody().orElseGet(() -> request.getQueryParameters().get("name")); return name == null ? "Please pass a name on the query string or in the request body" : "Hello " + name; }

public interface HttpTrigger

Methods

authLevel()

Determines what keys, if any, need to be present on the request in order to invoke the function. The authorization level can be one of the following values:

  • anonymous: No API key is required.

  • function: A function-specific API key is required. This is the default value if none is provided.

  • admin: The master key is required.

For more information, see the documentation about authorization keys.

dataType()

Defines how Functions runtime should treat the parameter value. Possible values are:

  • "": get the value as a string, and try to deserialize to actual parameter type like POJO

  • string: always get the value as a string

  • binary: get the value as a binary data, and try to deserialize to actual parameter type byte[]

methods()

An array of the HTTP methods to which the function responds. If not specified, the function responds to all HTTP methods.

name()

The variable name used in function code for the request or request body.

route()

BindingName("id") int id, final ExecutionContext context ) { .... context.getLogger().info("We have " + category + " with id " + id); .... }

For more details on the route syntax, refer to the online documentation.

Applies to