Idek.net API
The idek.net API allows you to perform all your url shortening tasks directly from an application, rather than using the webpage. The API goes straight to business by only returning the data that you need, and in the simplest format. This allows any application to quickly and easily create urls that are much shorter and easily fit into restricted character limit fields, whether that be on twitter, plurk, a bio, or anywhere else.
Creating a idek (short) url
To create a url you just need access the url below:
http://beta.idek.net/shorten/?idek-api=true&idek-ref=your_app&idek-anchor=anchortag&idek-url=http://yourlonglink.com
This url will return just the text of your short url:
http://idek.net/ABC
Parameters in detail
idek-api is the parameter that tells idek.net to just return the generated short url rather than a whole webpage
idek-url is the url that you want shortened by idek.net
idek-anchor is optional and allows you to specify any anchor tags that are included on this link, exclude the #
idek-ref is optional and allows you to specify the referring site or application. This is just used to metrics that will soon be made public. So if you use it, you'll probably get a mention
You may have noticed that the api call for creating new urls has changed - we will continue to support the old style (c.php calls) for the foreseeable future.
Resolving an idek (short) url
You only need to add the
idek-api=true name-value pair onto the end of the idek url to resolve via the api:
http://idek.net/ABC?idek-api=true
This will return just the text of your full url:
http://yourlonglink.com
Resolving with a callback
idek also supports a callback parameter, which will wrap the returning code in a javascript callback.
http://idek.net/ABC?idek-api=true&idek-callback=js_callback
This will return the url, quoted, and wrapped by the given callback text:
js_callback("http://yourlonglink.com")
API Responses
Generally you will just receive a url back from the idek api. This will be either the shortened or resolved URL.
A shortened url:
http://idek.net/123
A resolved url:
http://longerurl.com/site/path/page.html
Dealing with Errors
Although you will normally get a url back, you should still plan for the possibility of receiving an error code back from the idek API. Below you will find the error codes along with their meanings. All errors come back in the format:
Error ###: Error Message [(Misc Info)]
Error 300: This url was found to be in violation of our TOS (URL)
This url has been marked as abusive by our support staff. We do not suggest redirecting to it, however, the actual url is still included in the message in case you want to live on the edge.
Error 301: Bad Domain Name (DOMAIN_WE_PARSED_OUT)
The domain name we parsed from your url has been banned within our system (exact banned domain name included in message). You will not be able to create any shortened urls from this domain. Ever.
Error 302: Bad Domain Name - login required (DOMAIN_WE_PARSED_OUT)
The domain name we parsed from your url has been banned within our system for users who are not logged in (exact banned domain name included in message). You will not be able to create any shortened urls from this domain unless the user is logged in - we do this for general risky domains that may be used in certain situations for non-nefarious purposes. Due to a lack of api authorization at the moment this means the user will need to utilize the web interface to create a shortened version of this url.
Error 303: Error 303: Bad Filename - login required (DOMAIN_WE_PARSED_OUT)
The filename we parsed from your url has been banned within our system for users who are not logged in (file url is included for debugging). You will not be able to create any shortened urls to this file unless the user is logged in - we do this for general risky file types that may be used in certain situations for non-nefarious purposes. Due to a lack of api authorization at the moment this means the user will need to utilize the web interface to create a shortened version of this url.
Error 404: This short is invalid for this service (RECEIVED_SHORT)
When attempting to resolve a shortened url, this error means we have no record of having given out this short url. The short url we received is included for debugging purposes.
Error 404: No url was received
When attempting to shorten a url, this error means the url parameter was missing from the request.
Error 405: Your url does not have 'http[s]://' in it (RECEIVED_URL)
This error is found if you tried to shorten a url without the protocol attached to the front end (e.g. yoursite.com). You will always need to attach the protocol. The entire url we received is included for debugging purposes.
Error 406: Invalid Url Passed (RECEIVED_URL)
We could not parse this to a valid url. The entire url we received is included for debugging purposes.