This is an old revision of the document!
URL shortener service
This is a web service that allows the user to shorten a URL into a small string, similar to Tiny URL, bit.ly, etc. A shortened URL can be edited to change the source URL. Here are some use cases for a user who uses the web service.
Shortening a HTTP/HTTPS URL
The web app submits a HTTP
URL to the web service.
If the service detects that the
URL belongs to a well-known website that also has iOS / Android apps, then the server builds URLs with app-specific schemes that will be used for iOS and Android.
If the
URL does not belong to any well-known website with known apps, then the server will use the same HTTP
URL for iOS and Android also.
The server returns the following to the web app
If the
URL belongs to a well-known app, then which well-known app it is, e.g. facebook, amazon.
The HTTP
URL that was submitted by the web app.
The
URL that will be used by iOS. If not a well-known app, this
URL is the same as the HTTP
URL.
The
URL that will be used by Android.
-
Creating a shortened URL based on user's entry
The web app submits the following details to the web service. Note that the web app can send all three or just one, if only a specific device is being targetted.
-
-
A seperate
URL for Android.
In response, the server creates a short
URL and returns the following response.
The HTTP
URL exactly as submitted by the web app. If this field was blank, then the it is left blank.
The iOS
URL as submitted by the web app.
The Android
URL as submitted by the web app.
-
Updating a shortened URL
The web app submits the following details to change within a
URL. The web app may submit all three or just one or two of the following.
-
-
-
One of the following happens at the server.
If the web app submitted only the HTTP
URL, then the server detects if it is from a well-known website.
If a well-known website with an app, an app-specific iOS and Android
URL are generated.
If not a well-known website, then the HTTP
URL is used for iOS and Android.
Along with the HTTP
URL, if the web app also submits iOS or Android
URL manually, then the server does not detect an app-specific
URL for that
OS. It will stick with what the web app has submitted.
After saving the changes to the shortened
URL, the server returns the following to the web app.
-
the latest iOS
URL: either same as what web app submitted or otherwise auto-detected
the latest Android
URL: either same as what web app submitted or otherwise auto-detected
the short
URL, which remains unchanged despite the updation
User sign up
The web app submits the email address and password of the new user.
The server creates a new record in its database, but keeps the user as 'provisional'.
The server generates a confirmation code for the email.
The server sends an email to the address of the user for verification. This mail contains a link with the verification code. <br/>Please note that the user cannot start using the service before email confirmation. Otherwise, it becomes easy for a robot service to create thousands or lakhs of users at a time and abuse our service.
The server replies with a success code to the web app, which shows a message to the user prompting him/her to check his/her email and confirm by clicking on the confirmation link.
Confirm email
The user clicks on the verification link inside the confirmation email.
The server validates the code inside the verification link.
If the code is valid, then the user's status is moved from 'provisional' to 'confirmed'.
The server returns success and redirects the user to the login page.
Login
The web app submits the email and password to log in.
The server verifies the input and generates an OAuth token for the web app to use for all further requests.
The server returns the token to the web app, which saves it in local storage.
The web app does not have to use the login page again, as long as it holds onto the token and the token hasn't expired.