Campfire API

Rooms

The rooms API allows you to access information about any room under the account and lock/unlock the rooms.

List all

GET /rooms.xml

Returns a collection of the rooms that are visible to the authenticated user.

Response

Status: 200 OK

<rooms type="array">
  <room>
    <id type="integer">1</id>
    <name>North May St.</name>
    <topic>37signals HQ</topic>
    <membership-limit type="integer">60</membership-limit>
    <full type="boolean">false</full>
    <open-to-guests type="boolean">true</open-to-guests>
    <active-token-value>#{ 4c8fb -- requires open-to-guests is true}</active-token-value>
    <updated-at type="datetime">2009-11-17T19:41:38Z</updated-at>
    <created-at type="datetime">2009-11-17T19:41:38Z</created-at>
  </room>
  ...
</rooms>

Present rooms

GET /presence.xml

Returns a collection of the rooms that the authenticated user is present in.

Response

Status: 200 OK

<rooms type="array">
  <room>
    <id type="integer">1</id>
    <name>North May St.</name>
    <topic>37signals HQ</topic>
    <membership-limit type="integer">60</membership-limit>
    <full type="boolean">false</full>
    <open-to-guests type="boolean">true</open-to-guests>
    <active-token-value>#{ 4c8fb -- requires open-to-guests is true}</active-token-value>
    <updated-at type="datetime">2009-11-17T19:41:38Z</updated-at>
    <created-at type="datetime">2009-11-17T19:41:38Z</created-at>
  </room>
  ...
</rooms>

Show

GET /room/#{id}.xml

Returns an existing room. Also includes all the users currently inside the room.

Response

Status: 200 OK

<room>
  <created-at type="datetime">2009-11-17T19:41:38Z</created-at>
  <id type="integer">1</id>
  <membership-limit type="integer">60</membership-limit>
  <name>North May St.</name>
  <topic>37signals HQ</topic>
  <updated-at type="datetime">2009-11-17T19:41:38Z</updated-at>
  <open-to-guests type="boolean">true</open-to-guests>
  <full type="boolean">false</full>
  <active-token-value>4c8fb</active-token-value>
  <users type="array">
    <user>
      <admin type="boolean">true</admin>
      <created-at type="datetime">2009-11-20T16:41:39Z</created-at>
      <email-address>jason@37signals.com</email-address>
      <id type="integer">1</id>
      <name>Jason Fried</name>
      <type>Member</type>
      <avatar-url>http://asset0.37img.com/global/.../avatar.png</avatar-url>
    </user>
    ...
  </users>
</room>

Upload a file

POST /room/#{id}/uploads.xml

Uploads a file to the room. POST a multipart/form-data request body (rfc 2388). The file parameter must be named ‘upload’.

Request

Content-Type: multipart/form-data; boundary=---------------------------XXX

Content-Length: 8922

-----------------------------XXX
Content-Disposition: form-data; name="upload"; filename="me.jpg"
Content-Type: image/jpeg
...

Response

Status: 201 Created

<upload>
  <byte-size type="integer">8922</byte-size>
  <content-type>image/jpeg</content-type>
  <created-at type="datetime">2009-11-20T23:26:51Z</created-at>
  <id type="integer">1</id>
  <name>me.jpg</name>
  <room-id type="integer">1</room-id>
  <user-id type="integer">1</user-id>
  <full-url>https://account.campfirenow.com/room/1/uploads/1/me.jpg</full-url>
</upload>

Update

PUT /room/#{id}.xml

Updates an existing room. Only admins can rename a room, although any
user (except guests) may set the topic. Omitting either tag results in
that attribute being ignored. To remove a room topic, simply provide an
empty topic tag.

Request

<room>
  <name>#{name}</name>
  <topic>#{topic}</topic>
</room>

Response

Status: 200 OK

Recent messages

GET /room/#{id}/recent.xml

Returns a collection of upto 100 recent messages in the room. Accepts two additional optional parameters ‘limit’ to restrict the number of messages returned and ‘since_message_id’ to get messages created after the specified message id.

Response

Status: 200 OK

<messages type="array">
  <message>
    <created-at type="datetime">2010-04-15T11:03:08Z</created-at>
    <id type="integer">23</id>
    <room-id type="integer">1</room-id>
    <user-id type="integer">1</user-id>
    <body>Hello room!</body>
    <type>TextMessage</type>
    <starred>false</starred>
  </message>
  ...
</messages>

Recently uploaded files

GET /room/#{id}/uploads.xml

Returns a collection of upto 5 recently uploaded files in the room.

Response

Status: 200 OK

<uploads type="array">
  <upload>
    <byte-size type="integer">135</byte-size>
    <content-type>application/octet-stream</content-type>
    <created-at type="datetime">2009-11-20T23:26:51Z</created-at>
    <id type="integer">1</id>
    <name>char.rb</name>
    <room-id type="integer">1</room-id>
    <user-id type="integer">1</user-id>
    <full-url>https://account.campfirenow.com/room/1/uploads/4/char.rb</full-url>
  </upload>
  ...
</uploads>

Upload object from an upload message

GET /room/#{id}/messages/#{upload_message_id}/upload.xml

Returns the upload object related to the supplied upload message id.

Response

Status: 200 OK

<upload>
  <byte-size type="integer">135</byte-size>
  <content-type>application/octet-stream</content-type>
  <created-at type="datetime">2009-11-20T23:26:51Z</created-at>
  <id type="integer">1</id>
  <name>char.rb</name>
  <room-id type="integer">1</room-id>
  <user-id type="integer">1</user-id>
  <full-url>https://account.campfirenow.com/room/1/uploads/4/char.rb</full-url>
</upload>

Join

POST /room/#{id}/join.xml

Join a room.

Response

Status: 200 OK

Leave

POST /room/#{id}/leave.xml

Leave a room.

Response

Status: 200 OK

Lock

POST /room/#{id}/lock.xml

Locks a room.

Response

Status: 200 OK

Unlock

POST /room/#{id}/unlock.xml

Unlocks a room.

Response

Status: 200 OK