Skip to content
skermes edited this page Mar 17, 2013 · 34 revisions

Topics

Topics

GET /topics

Response

[
  { "id": 1,
    "name": "Conversations",
    "unread_conversations": 3
  },
  { "id": 4,
    "name": "Structural",
    "unread_conversations": 0
  }
]

Returns a list of conversations that the logged-in user is participating in. Each conversation has a name, id and a count of how many conversations in the topic are unread (again, for the logged-in user).


POST /topics

Request

{ "name": "Shenanigans" }

Response

{ "id": 6,
  "name": "Shenanigans",
  "unread_conversations": 0
}

Creates a new topic with the name supplied in the request. New, empty topics are guaranteed to have no unread conversations (more generally, they have no conversations of any sort).


GET /topics/1/conversations

Response

[
  { "id": 3,
    "name": "Talk about stuff",
    "most_recent_message": 1734512345,
    "most_recent_viewed": 1722345134,
    "participants": [
      { "id": 2,
        "name": "Paul Revere",
        "last_updated_time": 1235123423,
      },
      { "id": 4,
        "name": "Thomas Paine",
        "last_updated_time": 1613423423,
      }
    ]
  },
  { ... }
]

Returns a list of all the conversations the logged-in user is participating in in a particular topic. Each conversation has an id, a name, the timestamp of the last message in the conversation (most_recent_event), the timestamp of when the logged-in user last looked at the conversation (most_recent_viewed) and a list of participants. Each participant has and id, a name and the timestamp of when that user last posted a message to the conversation.

POST /topics/1/conversations

Request

{ }

Response

{ "id": 7,
  "title": "New Conversation"
}

Request

{ "title": "Chitter Chatter",
  "participants": [
    { "id": 5, 
      "name": "Benedict Arnold"
    },
    { "id": 7,
      "name": "Benjamin Franklin"
    }
  ],
  "actions": [
    { "type": "message",
      "user": 2,
      "text": "Hey, everyone"
    }    
  ]
}

Response

{ "title": "Chitter Chatter",
  "id": 7
}

Creates a new conversation in the given topic. The new conversation's name, participants and initial message are optional data in the request. If omitted, the new conversation will have a default title, no participants aside from the logged-in user and no messages. If supplied, the participants and actions will be applied to the message, but not returned in the response. They can be accessed at /conversations/7/participants and /conversations/7/actions, respectively.

Conversations

GET /conversations/3

Response

{ "id": 3,
  "title": "Talk about stuff"
}

Returns the id and title of a particular conversation.

GET /conversations/3/participants

Response

[
  { "id": 2,
    "name": "Paul Revere",
    "last_updated_time": 1234625721
  },
  { "id": 5,
    "name": "Ethan Allen",
    "last_updated_time": 1723424351
  }
]

Return a list of the users participating in a particular conversation. Each user has an id, a name and the timestamp of when the user last posted a message to the conversation.

POST /conversations/3/participants

Request

[
  { "id": 1,
    "name": "George Washington"
  }
]

Response

[
  { "id": 1,
    "name": "George Washington",
    "last_updated_time": null
  }
]

Enlists another user to participate in the conversation. Users who have never posted a message to the conversation have null for their updated timestamp. For sorting purposes, null should be considered to be before any non-null timestamp.

Clone this wiki locally