Applying Twitter's API "Best Practices" In A ColdFusion Application

Posted June 1, 2010 at 9:11 AM by Ben Nadel

Tags: ColdFusion

Twitter has become one of the most widely used APIs in the world. And as with anything that has become hugely successful, Twitter provides us developers with a wealth of educational material from which to learn. In this presentation, we will examine the Twitter API architecture and do our best to implement Twitter best practices in a sample ColdFusion application. This exploration will cover HTTP authentication, request validation, multi-format responses, and meaningful status code usage.

 
 
 
 
 
 
Appying Twitter's API Best Pracitces In A ColdFusion Application. 
 
 
 

This is probably the only time I'll do this presentation. After giving it, I just didn't feel that confident about the contents. I got some good feedback; but, I just never felt like I connected with it at a core level. However, feel free to take a look at the slides and download the code (including the sample Task List application).




Reader Comments

Jun 1, 2010 at 10:06 AM // reply »
31 Comments

I really enjoyed the presentation Ben. The best part for me though was the way you handled the error handling. Loved the way you surround the processing segment with a CFTRY and then throw your own error at varying points to handle the correct return code to the caller. Very clever and clean way of building the API. I'll certainly be looking to use a similar system in future.

Though that mic needed to be thrown out of the window. ;)


Jun 1, 2010 at 10:10 AM // reply »
148 Comments

I think you should keep this presentation . . . improve it. This is a topic I could stand to learn more about, especially since there are good APIs out there such as Flickr ready to be taken advantage of.


Jun 1, 2010 at 11:00 AM // reply »
4 Comments

Hey Ben,

This was indeed a great presentation my man, well done, really changed my perception on RESTful services, something which I've always shyed away from.

One thing that did cross my mind later that day when I was reflecting on this is that I've seen some funky behaviour with IIS7. I think that by default IIS7 will throw it's own custom error pages whenever you set the response code to anything other than 200.

So, in your case where you're returning XML or JSON formated error messages and adding a status code for 40x of 50x errors then IIS7 will throw it's own HTML content rather than your XML error messages.

I've not had time to look at this and see if that's exactly the case but my gut instinct, and experience of trying to throw friendly exception messages that still carry 50x status codes tells me that IIS7's default behaviour may cause some issues.

Any thoughts or ideas?

Robert


Jun 1, 2010 at 11:55 AM // reply »
13 Comments

Excellent write up. I've been doing a lot of work with writing API's recently. Both RESTful and SOAP. We should chat sometime about an API framework / best practices for ColdFusion developers.


Jun 1, 2010 at 6:24 PM // reply »
11,238 Comments

@James, @Robert,

Thanks guys :) I am not sure about IIS7. I've only ever rocked out on IIS6 (and lower). I would think you'd be OK though since it's already been handed off to the JRUN server (I like to pretend like I know thing-one about JRUN).

@Lola,

Ok, maybe I won't give up on it so fast.

@Wil,

Sounds like a good time my friend.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 17, 2013 at 7:42 PM
HashKeyCopier - An AngularJS Utility Class For Merging Cached And Live Data
Ben - thanks so much for posting these Angular articles and findings, they've been a huge help towards learning one of the more 'complex' JavaScript frameworks out there (IMO). I have been using Angu ... read »
May 16, 2013 at 5:01 PM
UPDATE: Parsing CSV Data Files In ColdFusion With csvToArray()
Your code was the closest thing I've found to obtaining some direction for converting ISO fields to values that CF can translate properly. Thank you for posting! ... read »
May 15, 2013 at 10:37 PM
Very Simple Pusher And ColdFusion Powered Chat
hi id making plz easy ... read »
May 15, 2013 at 6:07 PM
Making SOAP Web Service Requests With ColdFusion And CFHTTP
Ben, you once again saved my bacon at work. Thank you, thank you, thank you! ... read »
May 15, 2013 at 4:15 PM
What If All User Interface (UI) Data Came In Reports?
@Josh, Thanks! @Ben, I definitely recommend the David West book "Object Thinking" I've been quoting from. It goes deeply into the philosophy and history of OO programming. His breadth ... read »
May 15, 2013 at 11:36 AM
Ask Ben: Print Part Of A Web Page With jQuery
I found this helpfull when you need to keep (refresh) the original parent page after closing the iframe child print dialog (Hoping you're not using a form at this time so it won't submit again): On ... read »
May 14, 2013 at 7:13 PM
What If All User Interface (UI) Data Came In Reports?
@Jonah, If there's any books you'd recommend on the subject of domain modelling, I'd love to hear it. I just downloaded the free PDF of "Domain Driven Design Quickly". Figured I'd give it ... read »
May 14, 2013 at 6:57 PM
The UX Of Prototyping: Low-Fidelity Is The New High-Fidelity
@Phillip, I'm not sure I follow what you mean? Are you saying that you looked at the list of widgets provided by the jQuery UI and let that be your style guide? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools