URL Shortening Service

Overview

The URL shortening service is used to shorten long URLs. There are scenarios when we want to avoid sending very long URLs to the user via SMS, Whatsapp etc. This service compresses the URL.

Pre-requisites

Before you proceed with the configuration, make sure the following pre-requisites are met -

  1. Prior Knowledge of Java/J2EE

  2. Prior Knowledge of SpringBoot

  3. Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON etc.

Key Functionalities

  1. Compress long URLs.

  2. Converted short URLs contain id, which is used by this service to identify and get longer URLs.

Environmental Variable
Description

host.name

Host name to append in short URL

db.persistance.enabled

The boolean flag to store the short URL in database when flag is set as TRUE.

Deployment Details

  • Deploy the latest version of the URL Shortening service.

API Details

a) POST /egov-url-shortening/shortener

Receive long URLs and converts them to shorter URLs. Shortened URLs contain URLs to the endpoint mentioned next. When a user clicks on shortened URL, the user is redirected to a long URL.

b) GET /{id}

The shortened URLs contain the path to this endpoint. The service uses the id used in the last endpoint to get a long URL. In response, the user is redirected to the long URL.

Reference Docs

Description
Link

Swagger API Contract

Last updated

​All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.