-
Notifications
You must be signed in to change notification settings - Fork 32
Example HTTP API Messages
Mike Angstadt edited this page Aug 3, 2017
·
14 revisions
Method: POST
URI: /chats/ROOM_ID/events
Parameters:
Name | Value |
---|---|
mode | Always set to "messages" (without quotes) |
msgCount | The number of messages to retrieve. |
fkey | The fkey |
Response example
{
"events" : [
{
"event_type" : 1,
"time_stamp" : 1501615302,
"content" : "<b>hello</b> world",
"user_id" : 1064310,
"user_name" : "Tristan Wiley",
"room_id" : 1,
"message_id" : 38442657,
"message_stars" : 1
},
{
"event_type" : 1,
"time_stamp" : 1501636568,
"content" : "two",
"user_id" : 13379,
"user_name" : "Michael",
"room_id" : 1,
"message_id" : 38446507,
"message_edits" : 1
},
{
"event_type" : 1,
"time_stamp" : 1501636756,
"content" : "three",
"user_id" : 13379,
"user_name" : "Michael",
"room_id" : 1,
"message_id" : 38446514
}
],
"time" : 77918739,
"sync" : 1501636602,
"ms" : 0
}
Notes
- Events are sorted by timestamp.
- The "message_edits" field is only present if the message has been edited.
- The "message_stars" field is only present if the message has been starred.
Method: POST
URI: /chats/ROOM_ID/messages/new
Parameters:
Name | Value |
---|---|
text | The message to post |
fkey | The fkey |
Response example
{
"id" : 38469011,
"time" : 1501724999
}
Notes
- Chat messages are formatted in Markdown.
- Stack Overflow Chat will only recognize the Markdown formatting on messages that are not fixed-width and that do not exceed a single line of text (fixed-width messages are formatted in a monospace font; each line in a fixed-width message begins with four spaces)
- Single-lined messages cannot be longer than 500 characters.
Method: POST
URI: /chats/messages/MESSAGE_ID
Parameters:
Name | Value |
---|---|
text | The updated message content |
fkey | The fkey |
Responses
All responses are plain-text. The responses are actually enclosed in double quotes when received off the wire.
"ok"
"This message has already been deleted and cannot be edited"
"It is too late to edit this message."
"You can only edit your own messages"
- An HTTP 302 response means the specified message ID is too large and hasn't ever been assigned to a message.
Notes
- Messages older than 2 minutes cannot be edited.
Method: POST
URI: /chats/messages/MESSAGE_ID/delete
Parameters:
Name | Value |
---|---|
fkey | The fkey |
Responses
All responses are plain-text. The responses are actually enclosed in double quotes when received off the wire.
"ok"
"This message has already been deleted."
"It is too late to delete this message"
"You can only delete your own messages"
- An HTTP 302 response means the specified message ID is too large and hasn't ever been assigned to a message.
Notes
- Messages older than 2 minutes cannot be deleted.