Tuesday, 19 June 2012

Shorten urls using the bit.ly api without using oauth

There is a poorly documented feature of bit.ly, and that is using their shortening url without using oauth, as long as you're fine with stats being posted to your account (which is what you want in most cases when shortening urls anyways).

In their api for shorten (located @ http://dev.bitly.com/links.html#v3_shorten), it appears that it only accepts an oauth access_token.

However, there is a small blurb on another page allow the user to use the parameters apiKey and login. Just goto http://bitly.com/a/your_api_key and you will see your login and apiKey information. Use these two parameters instead of the access_token, and then you'll be in business.

So an example would look like this:


/v3/shorten?apiKey=blah&login=blah&longUrl=http%3A%2F%2Fgoogle.com%2F

Hope that saves someone the ten minutes I took to figure it out!


2 comments:

  1. I looked for this exact thing for hours. You're a lifesaver!

    ReplyDelete
  2. Did you know that you can shorten your long links with AdFocus and receive dollars from every click on your short urls.

    ReplyDelete