Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

RESTful API Example

Adrián Rivero edited this page Mar 16, 2017 · 5 revisions
@ServerModel(
    baseUrl= Config.SERVER,
    getHeaders = "Authorization=Bearer {token.getAccessToken()}",

    load = {
        @ServerRequest(
            name = "list",
            action = "user"
        ),
        @ServerRequest(
            name = "read",
            action = "user/{remote_id}"
        )
    },

    put = {
        @ServerRequest(
            name = "create",
            method = ServerRequest.RequestMethod.Post,
            action = "user",
            model = "this"
        ),
        @ServerRequest(
            name = "update",
            method = ServerRequest.RequestMethod.Put,
            action = "user/{remote_id}",
            model = "this"
        ),
        @ServerRequest(
            name = "delete",
            action = "user/{remote_id}",
            method = ServerRequest.RequestMethod.Delete
        )
    }
)
public class User extends BaseModel {
    @Model
    static Token_ token;

    String name;
    String email;
    String image;
    String password;
}