View Full Version : Campfire API and how can I use it with ExtJS 4.1

15 Feb 2013, 5:46 PM
I'm trying to learn doing an ExtJS MVC app this month and during this week I was trying to understand how I can do my app communicate with apps like Campfire API (http://developer.37signals.com/campfire/index) but I have no success.

I only need to do a simple request: I want to write a simple message in the campfire. (i.e: Message: A new user has been added.)

The use of the API is very easy:

curl -u [TOKEN]:[PASSWORD] -H 'Content-Type: application/json' -d '{"message":{"body":"Campfire API - Test 01"}}' https://[APP_ACCOUNT].campfirenow.com/room/[ROOM_ID]/speak.json

But HOW I could/should/can integrate it with my ExtJS app?

I already read the link listed below, and I tried to put in my code but I got lost.


Should I override the Ext.data.connection? Which structure I should change/extends to create a comunication between my ExtJS app with the Campfire API? or I will need to iterate this API with PHP and just sent the json to my ExtJS app?

I know that your time is very valuable and I don't want to spend it on stupid questions but I think that If I learn to interact with one API probably I will be able to advance in my learning. Additionally maybe my question could resolve others doubts, so any help/information will really be appreciated.


17 Feb 2013, 8:35 AM
Does campfirenow.com support CORS or JSONP?

17 Feb 2013, 10:09 AM
Hi, thanks for getting involved =D

Based on this thread:

CORS (https://groups.google.com/forum/?fromgroups=#!topic/37signals-api/j_UiI4YJ0ZU) (Campfire API doesn't seems that it support Cors.)
Regarding the jsonP I found this thread:

JSONP support for Campfire (https://groups.google.com/forum/?fromgroups=#!topic/37signals-api/ccO2RNHyB2Q) (Campfire API doesn't seems that supports jsonP.)
Additionally just to be sure I created a new thread asking about these two supports.

Other reference: Campfire API (https://github.com/37signals/campfire-api).

If it doesn't support both of them, what could be done on ExtJS side?

Thanks for the help.

21 Feb 2013, 1:58 PM
I create a new thread on 37signals-api, and I receive the confirmation:

No CORS or JSONP currently, though we're open to supporting them.
(by Jeremy Kemper)
Someone could give me an advice?

22 Feb 2013, 6:35 AM
Use a server side script that you can send a cURL or something to campfire.

Fredric Berling
22 Feb 2013, 7:24 AM
I have been using the Basecamp API wich looks to be the same for Campfire.

Its just a matter of doing som php for sending the correct rest request with curl. The returned Json is easily consumed by ExtJS.

I have a fully working example on gitHub for you to steal from.

Look at the model and store for "todolists" to get an understanding about the quirks. Especially for posting data back to them.


Please change the API key in the session.php if you are planning to use it. You can get one from 37Signals.

Note! It is made in ExtJS 4.2 with Sencha Cmd 3.1 so you would probably need that to rebuild it.