Updated Bit.ly ColdFusion Wrapper

On 2nd August I released a revised version of my bit.ly ColdFusion CFC Wrapper.

I had received an email from a user of the component who was having trouble with certain errors being returned from various calls to the API.

After a little investigation, I discovered that the API itself had changed; the code within the CFC was now failing due to an upgrade within the actual API.

What’s changed?

Quite a lot seems to have changed in the API version upgrade.

The error and stats methods from the version 2 API have now been deprecated and are no longer in use.

The current methods now available within the version 3 API are:

  • shorten
  • expand
  • validate
  • clicks
  • bitly_pro_domain
  • lookup
  • authenticate
  • info

As well as the available methods, the base URL for the API call was also changed. As such, this change has also been amended in the latest release of the bit.ly CFC wrapper.

How do I get it?

If you are using the CFC wrapper, I’d kindly suggest you upgrade to the latest version to avoid any unwanted errors due to the API change.

You can download the revised version of the API wrapper from bitly.riaforge.org

  • eyemkent

    Hi Matt –

    Another very useful offering, and another thank-you.

    Just because I noticed it, and was unable to fix myself, I thought I would point out that urls with hash tags aren’t working for me with this component.

    I tried “escaping” them by entering as ##, but that didn’t work either.

    Best,
    Kent

  • http://www.mattgifford.co.uk/ Matt

    Hi Kent

    Thanks for the comment, and glad you’ve found some use in the wrapper! :)

    That’s a good catch with the Hash issue. Here’s the way around it, using the direct link to your comment as an example (as it contains a hash):

    <!— Double-hash the URL to keep ColdFusion happy —>
    <cfset strURL = ‘http://www.mattgifford.co.uk/updated-bitly-cfc/comment-page-1/##comment-29814′ />

    <!— URLEncode the string to convert the characters into URL-friendly chars —>
    <cfset strURL = urlEncodedFormat(strURL) />

    <!— Run the bit.ly method with the revised URL —>
    <cfset shorten = objBitly.shorten(longURL=strURL,format=’xml’) />

    Double-hashing will keep CF happy, but we still need to URLEncode the characters. I may look into adding a separate built-in method to check for the existence of hashed URLs and manage this on behalf of the user.

    Until then, I hope that helps you.

  • http://www.clarkwebdesign.com Rick Clark

    Hi Matt,

    I am exploring the possibility of putting a CF qr code generator on my site. But I am not very experienced with using CFCs. I have been looking for examples on how to use this script, to no avail. Doy you know where I can go to find examples of how to use you bit.ly CFC? I already have the username and API key from bit.ly.

    Thank you in advance

  • http://www.mattgifford.co.uk/ Matt

    Hi Rich

    Thanks for the comment and for your interest in this component package.

    The blog contains a few posts with details on how to get up and running with the CFC, as well as generating the QR codes from the bit.ly links:

    http://www.mattgifford.co.uk/bitly-coldfusion-api

    http://www.mattgifford.co.uk/generate-qr-codes-with-bit-ly

    If there’s anything more specific you need, let me know!

    Many thanks,

    Matt