Adding Methods¶
Backendless console automatically prompts you to create a method as a part of the workflow for creating a new service. This is done because of a requirement that a service must have at least one method:
- Method Name - must be unique for a service. Method name cannot contain spaces and must not start with a number. Method name becomes a part of the generated REST route unless it is overridden with the REST Route parameter.
- REST Operation - an optional parameter. If specified, identities an HTTP operation which the method will respond to. Available options are:
GET
- indicates that the method must returns a value. The method should not change any internal state of the application. This is strictly a data retrieval operation.POST
- represents an operation responsible for creating a new resource or storing some initial content/state.PUT
- this type of operation is used for updating existing resources/content/state.DELETE
- is used to delete resources stored in the application.
If a REST operation is not explicitly set, Backendless selects one based on the method name prefix using the rules below:
method name prefix |
HTTP operation |
---|---|
addXXX |
POST |
setXXX |
PUT |
deleteXXX |
DELETE |
getXXX |
GET |
none of the above - foobar |
POST |
- REST Route - an optional parameter. If specified, becomes part of the URL used for RESTful service invocations. Otherwise, the value is the method name in lower case.
Additional methods can be added at a later time. Use the "+" icon under the service name: