Skip to content

Crum.bs API is here!!!

by admin on July 13th, 2010 ReTweet

Contents:

  1. Introduction
  2. Which API is best for you?
  3. “Simpleshorten”
  4. Advanced Shorten

Introduction:

First of all, we’d like to thank you for your interest in crum.bs! Crum.bs is a url shortening service with a very simple API. All will be explained in this documentation, which will explore the options available, help you decide which is right for you, and give examples as to how to actually develop with crum.bs in mind.

Good luck, and thanks again. If you have any questions, do not hesitate to contact us via twitter. @Crum_bs


Which API is best for you?

Which API is best for you is a matter of what options you want your users to have when shortening their urls, and whether you are prepared to use a more complicated request for data, as well as a more complicated parsing of a response.

Below are a list of questions you should ask yourself to help decide which is better to use:

  • Are you prepared to…
    • submit form data?
    • parse JSON?
  • Would your users benefit from…
    • url limits and password protection?
    • being able to edit the description?
  • Are cross domain requests a problem (Javascript users)?
  • Do the features of the advanced API outweigh the potential extra code/libraries/complexity of it, when compared with simpleshorten?

“Simpleshorten”

“Simpleshorten” is a very simple and easy way to generate shortened links. To use “Simpleshorten”, simply use the following API syntax:

http://crum.bs/api.php?function=simpleshorten&url=[insert url here]

An example response:

http://crum.bs/l/aa

One of the major drawbacks with simpleshorten is the lack of errors. If there is an error, simpleshorten will send an empty response. Errors include malformed urls and no url. On the other hand, simpleshorten is incredibly easy to build into your application. Because there is no JSON surrounding the url, or any extra information, it greatly simplifies the process of getting the url back into your app.

Please note: The user must be aware that by using the shortening service through your app, they are agreeing to the Terms and Conditions.


Advanced Shorten

Advanced Shorten gives the developer powerful features for his application’s shortened links. All the options available on the crum.bs website are also offered on the API. This means an app can take advantage of password protecting links, limiting the amount of visits to a link, and editing the description of the link its self.

Advanced Shorten uses POST requests to send data. The reason for this is because it is standard practice for APIs to use POST when submitting data, and GET when requesting data. Simpleshorten flouts this rule for the sake of simplicity and for those whom are affected by cross domain request restrictions.

Advanced Shorten sends responses in JSON. Learn about JSON here. JSON.org is also a valuable resource, which includes many links to libraries for your apps’ language.

Example POST variables:

url = "http://www.johnhamelink.com/"
desc = "Johnhamelink.com is a web development blog."
custom = "jhamelink"
password = "fdlk45nb05f"
limit = 200
terms = 1

An example response with the above variables:

{"short":"http://crum.bs/l/jhamelink","url":"http://www.johnhamelink.com/","id":"55","date":[date],"submitip":[submit ip],"limit":200}

From → Development, General

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS