A Code Kata for building a REST client-server chat app for Android.
Follow the README in client directory
The following are the definition of the API resources.
This the main resource of the chat server.
Endpoint: /api/chat
Method: GET
Parameters:
Name | Type | Description | Mandatory | Cardinality | Example |
---|---|---|---|---|---|
seq | Integer | Sequence from last received message. No present if this is the first call | No | 1 | /api/chat?seq=3 |
Response:
-
Response when there are new messages:
{ "messages": [ {"nick":"user1", "message":"hi there"}, {"nick":"user2", "message":"hola"} ], "last_seq": 6 }
-
Response when there are no new messages:
{ "messages": [], "last_seq": 6 }
Errors:
Status Code | Body | Description | |
---|---|---|---|
400 |
| When the seq parameter is invalid (e.g. an string) |
Method: POST
Body:
{
"nick":"user1",
"message": "Hola Mundo Reader"
}
Errors:
Status Code | Body | Description | |
---|---|---|---|
400 |
| When no body or invalid JSON is sent | |
400 |
| When the user nick is missing in the body | |
400 |
| When the message is missing in the body |
This work is licensed under a Creative Commons Attribution 3.0 Unported License.