Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 1.37 KB

API.md

File metadata and controls

76 lines (52 loc) · 1.37 KB

simple-message-project/API

The following API usage examples assume httpie but curl or wget works just as well

HealthCheck

http GET 'http://localhost:4000/ping'

Users

List all users

http GET 'http://localhost:4000/api/users'

Get user by id

http GET 'http://localhost:4000/api/users/1'

Create new user

http --json POST 'http://localhost:4000/api/users' \
    'Content-Type':'application/json; charset=utf-8' \
    uuid="user123"

Chats

Create a chat

http --json POST 'http://localhost:4000/api/chats' \
    'Content-Type':'application/json; charset=utf-8' \
    userId:=1 \
    recipientId:=2

Get chat by id

Includes messages associated between two in the chat upto 100 messages and younger than 30 days old

http --json GET 'http://localhost:4000/api/chats/1'

Messages

List all messages

Includes all messages across all chats upto 100 messages and younger than 30 days old

http GET 'http://localhost:4000/api/all-messages'

Get message by id

http --json GET 'http://localhost:4000/api/messages/1'

Create a message

http --json POST 'http://localhost:4000/api/messages' \
    'Content-Type':'application/json; charset=utf-8' \
    content="hola!" \
    sendById:=1 \
    chatId:=1