Endpoint Annotations
Endpoint annotations describe API configuration, methods, parameters, and
other vital details that define the properties and behavior of the Endpoint.
The annotation that specifies configuration and behavior across the entire API
(affecting all the classes exposed in the API and all their exposed methods) is
@Api
.
All public, non-static, non-bridge methods of a class annotated with
@Api
will be exposed in the public API.
If you need special API configuration for a particular method, you can optionally use @ApiMethod to set configuration on a per method basis. You configure these annotations by setting various attributes, as shown in the tables below.
@Api: API-Scoped Annotations
The annotation
@Api
is used to configure the whole API, and apply to all public methods of a class
unless overridden by
@ApiMethod
.
(To override a given
@Api
annotation for a specific class within
an API, see
@ApiClass
and
@ApiReference
.)
Required Imports
To use this feature, you need the following import:
import com.google.api.server.spi.config.Api;
Attributes
@Api Attributes | Description | Example |
---|---|---|
audiences
|
Required if your API requires authentication and if you are supporting Android clients.For more information, see Client IDs and Audiences . |
audiences = {"1-web-apps.apps.googleusercontent.com", "2-web-apps.apps.googleusercontent.com"}
|
backendRoot
|
The root URL used for method calls to backend instances. If not supplied, the default
https://your_app_id.appspot.com/_ah/spi
is used.
|
backendRoot = "https://example.appspot.com/_ah/spi"
|
canonicalName
|
Optional. Used to specify a different or more readable name for the API
in the client library
. This name is used to generate the names in the client library; the backend API continues to use the value specified in the
name
property.
|