Skip to content

bhaskar8088/generate-tracking-number

Repository files navigation

Tracking Number Generator API

This project implements a RESTful API using Django REST Framework to generate unique tracking numbers for parcels. The API ensures the generated tracking numbers follow a specified format, are unique, and can handle high concurrency and scalability.

Features

  • Generates unique tracking numbers that match the regex pattern ^[A-Z0-9]{1,16}$
  • Ensures no duplicate tracking numbers are generated.
  • Validates input fields using Django Rest Framework serializers
  • API optimized for scalability and high concurrency

Requirements

  • Python 3.x
  • Django 3.x or later
  • Django REST Framework 3.x or later

Setup

1. Clone the repository:

git clone [email protected]:bhaskar8088/generate-tracking-number.git

# Create a new virtual environment

python -m venv venv
source venv/bin/activate

cd generate_tn_django

### Virtualenv


# Install requirements

pip install -r requirements.txt

# Run migrations
python manage.py migrate

# Run server
python manage.py runserver

How to test

GET http://localhost:8000/api/tracking_numbers/generate-tn/ in postman with the below query params:

origin_country_id
destination_country_id
weight
customer_id
customer_name
customer_slug

# Below is an example

origin_country_id=IN
destination_country_id=SG
weight=2
customer_id=62954f05-a05e-4b53-aabd-f35663e6e507
customer_name=sachin
customer_slug=sachin

Below is the postman screenshot:

Postman

Public URL

Currently, its deployed to EC2

Here is the url:

http://3.93.175.178/api/tracking_numbers/generate-tn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages