Annotation Interface ApiEndpoint
The
ApiEndpoint
annotation is used to declare and document an HTTP
(RESTful) endpoint. It is also used by the kOS "OpenAPI Engine" to dynamically
generate documentation for the currently installed set of endpoints.
The return value from the annotated method will be converted to json and sent to the client. This can be modified in the following ways:
@JsonView(viewClass)
: This annotation can be used to restrict which fields from the response are sent back to the client. This view is provided to the json mapper when converting the response.stream=true
parameter : This parameter indicates that the handler will write directly to the response output stream so the return value should be ignored. This can be used to serve arbitrary content or return a different style response to a client that expects a particular response format that doesn't match the standard kOS envelope format.
@ApiController
annotation. This will
be prefixed to every endpoint defined within the controller. For example, to prefix all
mappings with "/myService", use @ApiController(base = "/myService")
on the class.
It is possible to add request handlers from classes that do not use the @ApiController
but the standard kOS infrastructure typically looks for instances in a BeanContext
with this annotation and automatically processes the associated endpoints.
When a method is annotated with a mapping annotation additional annotations may be used on the method parameters to automatically gain access to data from the request. For more details please see the following annotations:
@HandleVariable
@PathVariable
@RequestBody
@RequestParam
@Tracker
version
parameter. By default, the version
will come from the version indicated in @ApiController
but setting the version
param in the @ApiEndpoint
annotation will override it. The version will be returned as
part of the standard kOS response envelope.- Since:
- 1.0
- Version:
- 2023-02-16
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSets the URL path of the associated DELETE operation.boolean
If true, endpoint is deprecatedSets the URL path of the associated GET operation.boolean
If true, exclude endpoint from openapi docs.boolean
If true, endpoint is internal and should not be used for production systems as the endpoint may change at any timeDocuments the URL parameters.Sets the URL path of the associated POST operation.Sets the URL path of the associated PUT operation.boolean
If true, this returns a stream, not json data.String[]
Tags that can be used in auth handlers.The api version.
-
Element Details
-
desc
String descDescription of the endpoint.
-
-
-
GET
String GETSets the URL path of the associated GET operation.- Default:
- ""
-
PUT
String PUTSets the URL path of the associated PUT operation.- Default:
- ""
-
POST
String POSTSets the URL path of the associated POST operation.- Default:
- ""
-
DELETE
String DELETESets the URL path of the associated DELETE operation.- Default:
- ""
-
params
ApiEndpoint.Param[] paramsDocuments the URL parameters. Name of @Param should match a named parameter in the request handler.- Default:
- {}
-
tags
String[] tagsTags that can be used in auth handlers.- Default:
- {}
-
version
String versionThe api version.- Default:
- ""
-
stream
boolean streamIf true, this returns a stream, not json data.- Default:
- false
-
deprecated
boolean deprecatedIf true, endpoint is deprecated- Default:
- false
-
internal
boolean internalIf true, endpoint is internal and should not be used for production systems as the endpoint may change at any time- Default:
- false
-