Tailoring the generated REST API
REST is really a tool for service integration. To match the requirements of an existing service, you need control of several parameters such as the path, HTTP method, or header parameters.
Changing the generated path
As in the case of a web application, the URL path and HTTP method is derived from the function to be called.
A @property
method uses the HTTP GET
method to read the property and PUT
to write the property. The HTTP method of all the other methods is derived from the prefix of the method name:
Prefix |
HTTP method |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The default HTTP POST
method is used if the method is neither an @property
method nor a method that can be derived from the preceding table. You can set the HTTP method with the @method
annotation:
@method(HTTPMethod.GET) Note retrieveNote...