Skip to content

Latest commit

Β 

History

History
103 lines (65 loc) Β· 1.99 KB

File metadata and controls

103 lines (65 loc) Β· 1.99 KB

QR Code API

This project provides a simple REST API for generating QR codes dynamically using Spring Boot and ZXing. You can customize the content, size, type, and error correction level of the QR codes.


πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/IbnBaqqi/qrcode-api.git
cd qrcode-api

2. Run the Application

This is a Gradle project. To start the application:

./gradlew bootRun

If you're on Windows:

gradlew.bat bootRun

Once running, the application will be available at:

http://localhost:8080

πŸ“š API Documentation

This API has no authentication or complex setupβ€”just one endpoint to generate QR codes.


πŸ§ͺ Example API Usage

Health Check

Check if the API is up:

GET /api/health

Generate a QR Code

GET /api/qrcode

Query Parameters

Parameter Type Required Default Description
content string βœ… – Text to encode in the QR code
size int ❌ 250 Image size in pixels (150–350 allowed)
type string ❌ png Image format: png, jpeg, or gif
correction char ❌ L Error correction level: L, M, Q, or H

Example Request

curl "http://localhost:8080/api/qrcode?content=https://github.com/IbnBaqqi&size=300&type=png&correction=H" --output qrcode.png

πŸ›‘ Validation Rules

  • content must not be blank
  • size must be between 150 and 350
  • type must be one of: png, jpeg, gif
  • correction must be one of: L, M, Q, H

Invalid input returns 400 Bad Request.


πŸ”§ Tech Stack

  • Java 21
  • Spring Boot
  • Gradle
  • ZXing

πŸ› Found a Bug?

Please open an issue with steps to reproduce or an example request.