aboutsummaryrefslogtreecommitdiff

API

The api is available on /api.

GET / Gets information about the server - Return type: JSON - Returns:

GET /ping Pings the server - Return type: JSON - Returns: pong

POST /create_user/ Creates a new user with name - Data type: JSON - Data: String of wanted username - Return type: JSON - Returns: UID of user

DELETE /delete_user Deletes a user - Data type: JSON - Data: UID - Return type: JSON - Returns: Result

POST set_user_data Sets data in the user fields - Data type: JSON - Data: {user: UID, field: ReceiveDataField, data: String} - Return type: JSON - Returns: Result

GET /get_user/<id> Gets a user from id - Return type: JSON - Returns:

GET /get_user_by_name Gets a user from name - Data type: JSON - Data: String - Return type: JSON - Returns:

GET /get_message/<id> Gets a message by id - Return type: JSON - Returns:

GET /get_message_id_newest Gets the newest message id - Return type: JSON - Returns:

GET /get_message_id_list/<from_id>/<to_id> Gets a list of message ids from_id to to_id inclusive (limit 25) - Return type: JSON - Returns: >

GET /get_message_list/<from_id>/<to_id> Gets a list of messages from_id to to_id inclusive (limit 25) - Return type: JSON - Returns: >

POST /send_message Sends a message - Data type: JSON - Data: ReceiveMessage - Return type: JSON - Returns: UID of message

DELETE /delete_message Deletes a message - Data type: JSON - Data: UID - Return type: JSON - Returns: Result

Types

  • ReceiveDataField
  • DisplayName
  • StatusText
  • Desc

  • ReceiveMessage

  • message: String
  • sender: UID
  • reply_to: Option

  • UID

  • u64

  • Date

  • u64 (date since epoch in UTC)

  • Status

  • Online
  • Offline
  • Away
  • Busy

  • User

  • id: UID
  • username: String (Max 20 chars)
  • displayname: String (Max 30 chars)
  • desc: String (Max 500 chars)
  • statustext: String (Max 60 chars)
  • status: Status
  • deleted: bool

  • Message

  • id: UID
  • message: String (Max 6000 chars)
  • reply_to: UID (of another message)
  • deleted: bool
  • date: Date
  • sender: UID (of a User)