API Q & A

What can I do with your API?

You can use our API to integrate our URL Shortener Service into your site or 3rd Party Application.

Do I need a private and public key or an account to use your API?

No, you do not HAVE to have an account to use our API unless you want to keep all links you share under a single account regardless of what IP address you shorten your links from. By default if you shorten a URL with us from a specific IP address, we group them together for you and allow you to view them at a later time by querying our API. If your IP however changes at any time in the future and you don't have an account with us you will not be able to view your URL shortening history any more. To avoid that, register for an account with us first, and make an API call to our GetToken API Method, then pass in the token your receive in any future calls. See sample code below for more details.

What formats does your API Support?

Our API supports both JSON and XML. If you send us a JSON request, we will send you a JSON response, and if you send us an XML request we will send you back an XML response.

API Anonymous Use

How do I get a list of links I have shortened so far based on my IP only?

Below is a sample call for getting a list of links you have shortened based on your IP only. Make a GET query to the following URL:

http://www.min.qa/api/v1

Here is a sample result you will receive for a standard HTTP GET query:


<ArrayOfLink xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/d3z.Entities"> 
<Link> 
            <Hash>SuGzTfkB</Hash> 
            <ID>120</ID> 
            <Timestamp>2014-09-26T10:03:54.363</Timestamp> 
            <URL>http://www.somelink.com/long-link-goes-here</URL> 
            <UserID>1</UserID> 
            <UserIP>127.0.0.1</UserIP> 
            <VisitCount>0</VisitCount> 
</Link> 
<Link> 
            <Hash>xWYMq00O</Hash> 
            <ID>121</ID> 
            <Timestamp>2014-09-26T10:27:39.36</Timestamp> 
            <URL>http://www.somelink.com/long-link-goes-here</URL> 
            <UserID>1</UserID> 
            <UserIP>127.0.0.1</UserIP> 
            <VisitCount>0</VisitCount> 
</Link> 
<Link> 
            <Hash>7j0Txaxw</Hash> 
            <ID>122</ID> 
            <Timestamp>2014-09-26T10:30:34.31</Timestamp> 
            <URL>http://www.somelink.com/long-link-goes-here</URL> 
            <UserID i:nil="true"/> 
            <UserIP>127.0.0.1</UserIP> 
            <VisitCount>0</VisitCount> 
</Link> 
</ArrayOfLink>
                

And Here is a sample result you receive back if your query was in JSON:

[{ 
            "ID":120, 
            "UserID":1, 
            "UserIP":"127.0.0.1", 
            "Hash":"SuGzTfkB", 
            "URL":"http://www.somelink.com/long-link-goes-here", 
            "Timestamp":"2014-09-26T10:03:54.363", 
            "VisitCount":0 
}, 
{ 
            "ID":121, 
            "UserID":1, 
            "UserIP":"127.0.0.1", 
            "Hash":"xWYMq00O", 
            "URL":"http://www.somelink.com/long-link-goes-here", 
            "Timestamp":"2014-09-26T10:27:39.36", 
            "VisitCount":0 
}, 
{ 
            "ID":122, 
            "UserID":null, 
            "UserIP":"127.0.0.1", 
            "Hash":"7j0Txaxw", 
            "URL":"http://www.somelink.com/long-link-goes-here", 
            "Timestamp":"2014-09-26T10:30:34.31", 
            "VisitCount":0 
}]

below is an explaination of each column result:

ID - Record ID Number
UserID - User Account ID Number
Hash - The shortened URL String Hash. To get the full shortened URL, add http://www.min.qa/ + Hash (which will give you a shortened URL like http://www.min.qa/SuGzTfkB.
URL - The full URL prior to shortening the link.
Timestamp - Date and Time the shortened URL was created.
VisitCount - Shows how many times a particular link was visited.


How do I get a specific record based on it's ID:

Below is a sample call for getting a single link you have shortened based on it's ID. Note that your IP will have to match the IP that created this record in order for you to get a result. Make a GET query to the following URL:

http://www.min.qa/api/v1/120

Here is a sample result you will receive for a standard HTTP GET query:

<Link xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/d3z.Entities"> 
            <Hash>SuGzTfkB</Hash> 
            <ID>120</ID> 
            <Timestamp>2014-09-26T10:03:54.363</Timestamp> 
            <URL>http://www.somelink.com/long-link-goes-here</URL> 
            <UserID>1</UserID> 
            <UserIP>127.0.0.1</UserIP> 
            <VisitCount>0</VisitCount> 
</Link>

And Here is a sample result you receive back if your query was in JSON:

{ 
            "ID":120, 
            "UserID":1, 
            "UserIP":"127.0.0.1", 
            "Hash":"SuGzTfkB", 
            "URL":"http://www.digioz.com/php", 
            "Timestamp":"2014-09-26T10:03:54.363", 
            "VisitCount":0 
}

How do I add a new link to shorten based on my IP only?

In order to shorten a new link, post a string value for a field called "URL" to the api link http://www.min.qa/api/v1. One way to accomplish this by using an HTML Form like the one below:

<html> 
<head> 
    <title>URL Shortener | Link Add Sample</title> 
</head> 
<body> 
    <h1>URL Shortener Link Add</h1> 
    <form id="form1" method="post" action="http://www.min.qa/api/v1" enctype="application/x-www-form-urlencoded"> 
        <div> 
            <label for="URL">URL</label> 
        </div> 
        <div> 
            <input name="URL" type="text" /> 
        </div> 
        <div> 
            <input type="submit" value="Submit" /> 
        </div> 
    </form> 
</body> 
</html>

Alternatively you can POST the following XML to the API URL above using whatever other method you wish to use:

<Link xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/d3z.Entities">  
            <URL>http://www.somelink.com/long-link-goes-here</URL>  
</Link>

If you use JSON, post the link in to the API URL in the following format:

{ 
            "URL":"http://www.somelink.com/long-link-goes-here" 
}

This will give you the following result in XML:

<Link xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/d3z.Entities"> 
            <Hash>iTdgD3cm</Hash> 
            <ID>132</ID> 
            <Timestamp>2014-10-29T13:56:56.0575545-05:00</Timestamp> 
            <URL>http://www.somelink.com/long-link-goes-here</URL> 
            <UserID i:nil="true"/> 
            <UserIP>127.0.0.1</UserIP> 
            <VisitCount>0</VisitCount> 
</Link>

If your request was in JSON, you will get the following JSON response:

{ 
    "ID":132, 
    "UserID":null, 
    "UserIP":"127.0.0.1", 
    "Hash":"iTdgD3cm", 
    "URL":"http://www.somelink.com/long-link-goes-here", 
    "Timestamp":"2014-10-29T13:56:56.0575545-05:00", 
    "VisitCount":0 
}