Update README with new API

This commit is contained in:
Maxwell Jeffress 2024-10-23 15:06:21 +11:00
parent 8cd6db79f5
commit ebe5e6b922

View File

@ -30,17 +30,57 @@ Chookpen is very simple in how it works at present. There's only one chat on eac
### Brief API documentation for the server
**Create account**
#### Create account
**Usage**
`http://(address:port)/api/createAccount/username:{(username)}token:{(password-hash)}`
**Send a message**
**Successful response**
`http://(address:port)/api/username:{(username)}token:{(password-hash)}message:{(message to send)}`
`Success`
**Get messages**
**Unsuccessful responses**
`http://(address:port)/api/username:{(username)}token:{(password-hash)}`
`Username already exists` - Choose a new username
`No username` - Add a username
`No token` - Add a token
#### Send a message
**Usage**
`http://(address:port)/api/send/username:{(username)}token:{(password-hash)}message:{(message to send)}`
**Successful response**
`Success`
**Unsuccessful responses**
`Unknown account` - Either you don't have an account or your username is wrong
`Invalid token` - Password is wrong
`No data provided` - Add a message
#### Get messages
**Usage**
`http://(address:port)/api/syncmessages/username:{(username)}token:{(password-hash)}`
**Successful response**
A successful response should contain everything in `chatHistory` in the directory you run the server in.
**Unsuccessful responses**
`Unknown account` - Either you don't have an account or your username is wrong
`Invalid token` - Password is wrong
## Some handy tips and tricks