Short URL

API

With this API you can easily get the short URL and all statistics in JSON or XML format by sending the long URL to the API. You can also access just the statistics without the system to count it as a new URL shortening.

Please, let us know if you use this API. We would really like to see what kind of cool app, widget or page you create. Thanks!

Method

To interact with the API use an HTTP GET request.

URL Format

https://go.kenda.fi/api/?format=<format>&url=<url>

Parameters

Name Description Value Required
format Render the response in the specified format.
Default: json
json
xml
no
url The long URL you want to shorten. This has to be URL encoded. In Javascript you can do that with encodeURIComponent() and in PHP with urlencode(). string yes

HTTP response status codes

Status code Description
200 OK Great success!
400 Bad Request The URL was not valid.
406 Not Acceptable The URL is already quite short.
406 Not Acceptable The URL seems to be blocked.
406 Not Acceptable The URL or parts of it seems to be blacklisted.
502 Bad Gateway Rate limit was exceeded.
503 Service Unavailable Some other error or the short URL service is in maintenance mode.

Examples

https://go.kenda.fi/api/?format=json
&url=www.codeigniter.com%2Fnews%2Fcodeigniter_2.0.0_released%2F

https://go.kenda.fi/api/?format=xml
&url=www.codeigniter.com%2Fnews%2Fcodeigniter_2.0.0_released%2F

Possible errors:

stdClass Object
(
    [status] => error
    [message] => The URL was not valid.
)

stdClass Object
(
    [status] => error
    [message] => The URL is already quite short.
)

stdClass Object
(
    [status] => error
    [message] => The URL seems to be blocked.
)

stdClass Object
(
    [status] => error
    [message] => The URL or parts of it seems to be blacklisted.
)

stdClass Object
(
    [status] => error
    [message] => Rate limit was exceeded.
)

stdClass Object
(
    [status] => error
    [message] => Some other error or the short URL service is in maintenance mode.
)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[The URL was not valid.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[The URL is already quite short.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[The URL seems to be blocked.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[The URL or parts of it seems to be blacklisted.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[Rate limit was exceeded.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[Some other error or the short URL service is in maintenance mode.]]></message>
</go>

Statistics API

Use this in case you want to get the same data including statistics as when creating a new short URL, but without the system to count it as a new URL shortening.

Method

To interact with the API use an HTTP GET request.

URL Format

https://go.kenda.fi/api/?format=<format>&shorturl=<shorturl>

Parameters

Name Description Value Required
format Render the response in the specified format.
Default: json
json
xml
no
shorturl The part of the short URL after https://go.kenda.fi/ string yes

HTTP response status codes

Status code Description
200 OK Great success!
400 Bad Request Disallowed characters. Send only the short URL ID.
404 Not Found URL not found.
410 Gone The requested link has been disabled. Please, see FAQ and Terms & Conditions.
502 Bad Gateway Rate limit was exceeded.
503 Service Unavailable Some other error or the short URL service is in maintenance mode.

Examples

https://go.kenda.fi/api/?format=json&shorturl=d

stdClass Object
(
    [status] => ok
    [message] => Great success!
    [short_url] => https://go.kenda.fi/d
    [long_url] => https://www.digitoday.fi/bisnes/2011/03/31/buzz-kummittelee-googlelle/20114578/66
    [percent_shorter] => 74
    [qrcode_img] => https://go.kenda.fi/d/qrcode/
    [qrcode_img_width] => 180
    [qrcode_img_height] => 180
    [link_accessed] => 23
    [link_added] => stdClass Object
        (
            [count] => 1
            [first_time] => 2011-03-31 15:32
            [last_time] => 
            [via_www] => 1
            [via_bookmarklet] => 0
            [via_api] => 0
            [via_other] => 0
        )

    [referrer_count] => 0
    [referrers] => Array
        (
        )

)

https://go.kenda.fi/api/?format=xml&shorturl=d

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>ok</status>
<message><![CDATA[Great success!]]></message>
<id>d</id>
<short_url>https://go.kenda.fi/d</short_url>
<long_url><![CDATA[https://www.digitoday.fi/bisnes/2011/03/31/buzz-kummittelee-googlelle/20114578/66]]></long_url>
<title><![CDATA[Google ja FTC sopivat kiistan Buzzin paljastuks...]]></title>
<percent_shorter>74</percent_shorter>
<qrcode_img width="180" height="180">https://go.kenda.fi/d/qrcode/</qrcode_img>
<link_accessed>23</link_accessed>
<link_added count="1">
 <first_time>2011-03-31 15:32</first_time>
 <last_time></last_time>
 <via_www>1</via_www>
 <via_bookmarklet>0</via_bookmarklet>
 <via_api>0</via_api>
 <via_other>0</via_other>
</link_added>
<referrers count="0">
</referrers>
</go>

Possible errors:

stdClass Object
(
    [status] => error
    [message] => Disallowed characters. Send only the short URL ID.
)

stdClass Object
(
    [status] => error
    [message] => URL not found.
)

stdClass Object
(
    [status] => error
    [message] => The requested link has been disabled. Please, see FAQ and Terms & Conditions.
)

stdClass Object
(
    [status] => error
    [message] => Rate limit was exceeded.
)

stdClass Object
(
    [status] => error
    [message] => Some other error or the short URL service is in maintenance mode.
)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[Disallowed characters. Send only the short URL ID.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[URL not found.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[The requested link has been disabled. Please, see FAQ and Terms & Conditions.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[Rate limit was exceeded.]]></message>
</go>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<go>
<status>error</status>
<message><![CDATA[Some other error or the short URL service is in maintenance mode.]]></message>
</go>