The educated guess approach proved to work well. Please find below a summary of the naming conventions I found working reliably. The code examples are based on the official tutorial.
GET
Method name starts with get or list
public HelloGreeting getGreeting(@Named("id") Integer id) {..}
GET http://localhost:8080/_ah/api/helloworld/v1/hellogreeting/0
public ArrayList<HelloGreeting> listGreeting() {..}
GET http://localhost:8080/_ah/api/helloworld/v1/hellogreeting
POST
There are no special conventions. POST is a fallback in case the method won't resolve to either GET or DELETE.
DELETE
Method name starts with remove or delete
public ArrayList<HelloGreeting>
removeGreeting(@Named("id") Integer id) {..}
DELETE http://localhost:8080/_ah/api/helloworld/v1/greeting/0
public ArrayList<HelloGreeting>
deleteGreeting(@Named("id") Integer id) {..}
DELETE http://localhost:8080/_ah/api/helloworld/v1/greeting/0
PUT
As far as I can tell it is impossible to get to a PUT method without using @ApiMethod.
@ApiMethod(name = "greetings.put", httpMethod = "put")
public ArrayList<HelloGreeting>
putGreeting(@Named("id") Integer id,
@Named("message") String message) {..}
PUT http://localhost:8080/_ah/api/helloworld/v1/putGreeting/0/hi%20there
This post is part of Google App Engine and Android - Pros and Cons, Challenges
No comments:
Post a Comment