URL Shortening service

Overview

The URL shortening service is used to shorten long URLs. There may be requirement 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 contains id, which is used by this service to identify and get longer URLs.

Environment Variable

Description

Environment 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 latest version of URL Shortening service

API Details

a) POST /egov-url-shortening/shortener

Receive long urls and converts them to shorter urls. Shortened urls contains urls to endpoint mentioned next. When user clicks on shortened URL, user is redirected to long URL.

b) GET /{id}

This shortened urls contains path to this endpoint. The service uses id used in last endpoint to get long URL. As response the user is redirected to long URL.

 

Reference Docs

Title

Link

Title

Link

Swagger API Contract

API Contract

Local Setup

URL Shortening Local Setup