Skip to content

PabloAz/chat-kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 

Repository files navigation

chat-kata

A Code Kata for building and REST client-server chat app for Android.

Server-side Kata

Follow the README in server directory

Client-side Kata

Follow the README in client directory

API Contract

The following are the definition of the API resources.

Chat Resource

This the main resource of the chat server.

Endpoint: /api/chat

Get chat messages

Method: GET

Parameters:

NameTypeDescriptionMandatoryCardinalityExample
seqIntegerSequence from last received message. No present if this is the first callNo1/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 CodeBodyDescription
400
{"error":"invalid seq parameter"}
When the seq parameter is invalid (e.g. an string)

Send chat messages

Method: POST

Body:

{
    "nick":"user1",
	"message": "Hola Mundo Reader"
}

Errors:

Status CodeBodyDescription
400
{"error":"invalid body"}
When no body or invalid JSON is sent
400
{"error":"missing nick parameter"}
When the user nick is missing in the body
400
{"error":"missing message parameter"}
When the message is missing in the body

About

A Code Kata for building and REST client-server chat app for Android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors