Home » Projects » URL Shortner
A python flask application to shorten the URL provided by users whether registered or not.
Live URL: https://vaibhavvikas-url-shortner.herokuapp.com/
Design a URL shortener that generates a shortened URL for the requested actual URL. The request could come from registered users or could be anonymous. The system should fulfill the following line items.
$ http://127.0.0.1:5000/user/register
{
"userid": "vaibhav_vikas",
"name": "Vaibhav Vikas"
}
Response 200 OK:
{
"message": "User created successfully",
"status": "SUCCESS"
}
$ http://127.0.0.1:5000/user/<userid:vaibhav_vikas>/shortenurl
{
"url": "google.com",
"ttl": 60
}
{"url": "google.com"}
Response 200 OK:
{
"data": {
"creation_time": "250622222218",
"owner": "vaibhav_vikas",
"shortened_url": "ZfcXBmEekiV",
"ttl": null,
"url": "youtube.com"
},
"message": "URL created successfully",
"status": "SUCCESS"
}
$ http://127.0.0.1:5000/user/<userid:vaibhav_vikas>/urls
Response 200 OK:
{
"data": {
"GeumgANQZMO": {
"creation_time": "250622222235",
"owner": "vaibhav_vikas",
"shortened_url": "GeumgANQZMO",
"ttl": 180,
"url": "yahoo.co.in"
},
"ZfcXBmEekiV": {
"creation_time": "250622222218",
"owner": "vaibhav_vikas",
"shortened_url": "ZfcXBmEekiV",
"ttl": null,
"url": "youtube.com"
}
},
"message": "URLs retrieved successfully for vaibhav_vikas!",
"status": "SUCCESS"
}
$ http://127.0.0.1:5000/url/shortenurl
{"url":"google.com"}
Response 200 OK:
{
"data": {
"creation_time": "250622222828",
"owner": null,
"shortened_url": "eZGWXEOanG",
"ttl": 60,
"url": "google.com"
},
"message": "URL created successfully",
"status": "SUCCESS"
}
$ http://127.0.0.1:5000/url/geturl/<shortened_url:eZGWXEOanG>
Response 200 OK:
{
"data": {
"creation_time": "250622222828",
"owner": null,
"shortened_url": "eZGWXEOanG",
"ttl": 60,
"url": "google.com"
},
"message": "URL retrieved successfully",
"status": "SUCCESS"
}
$ http://127.0.0.1:5000/url/listurls
Response 200 OK
{
"data": {
"GeumgANQZMO": {
"creation_time": "250622222235",
"owner": "vaibhav_vikas",
"shortened_url": "GeumgANQZMO",
"ttl": 180,
"url": "yahoo.co.in"
},
"ZfcXBmEekiV": {
"creation_time": "250622222218",
"owner": "vaibhav_vikas",
"shortened_url": "ZfcXBmEekiV",
"ttl": null,
"url": "youtube.com"
},
"eZGWXEOanG": {
"creation_time": "250622222828",
"owner": null,
"shortened_url": "eZGWXEOanG",
"ttl": 60,
"url": "google.com"
}
},
"message": "URLs retrieved successfully",
"status": "SUCCESS"
}
Vaibhav Vikas, 2022