Skip to content

URL Shortener

Chakshu Gautam edited this page Nov 11, 2021 · 1 revision

The usage of Template manager with a URL shortener can be used as follows.

Let's say you have a customised geolocation based dashboard url by districtID, blockID, clusterID
https://personalized-dashboard.com?disctrict=districtID&block=blockID&cluster=clusterID
but you want to have a personalised url for every user like - https://dash.sm/userID with a userID so they can remember the URL. Note the above can have 10 different parameters as well.

You have a million users and the dashboard's url changes frequently (or more get added every week).

So to create a million of these short URLs for every user, all you have to do is manage two templates

  1. https://personalized-dashboard.com?disctrict={{districtID}}&block={{blockID}}&cluster={{clusterID}}
  2. https://dash.sm/{{userID}}

The client here would be the URL Shortener or a different service that adds data to the URL shortener. It will send the following data per user

{
 "district": 1,
 "block": 4,
 "cluster": 10,
 "userID": 2345
}

and render these two templates and add them as long and short URL to the URL shortener to redirect.

Note

  • This can also be done dynamically to save space for the million records in the URL shortener service.
  • Since the response times will be in milliseconds, it won't add much to the URL Shortener latency.
Clone this wiki locally