Skip to content

PrabhatCS/ApiAccessFramework

Repository files navigation

go mod tidy

3. Run the application:
```bash
go run .

The server will start on port 8000 by default.

Usage

Web Interface

Visit http://localhost:8000 to access the web dashboard with the following services:

1. URL Shortener

  • Enter a long URL in the input field
  • Click "Shorten URL"
  • Copy and use the generated short URL

2. Website Health Monitoring

  • Enter a website URL to monitor
  • View real-time health metrics including:
    • Response time
    • Status code
    • SSL certificate validity
    • Uptime percentage

3. Mobile Number Verification

  • Enter country code (e.g., +1)
  • Enter phone number
  • Get instant verification results

4. File Protection

  • Maximum file size: 10MB
  • Supports any file type
  • Steps:
    1. Select a file
    2. Enter a password
    3. Choose "Protect File" or "Unlock File"
    4. Download the processed file

API Documentation

URL Shortener

Shorten URL

POST /api/url/shorten
Content-Type: application/json

{
    "url": "https://example.com/very/long/url"
}

Response:

{
    "short_url": "abc123"
}

Get URL Stats

GET /api/url/stats/{shortCode}

Response:

{
    "short_code": "abc123",
    "hit_count": 42,
    "created_at": "2025-02-15T10:00:00Z",
    "last_access": "2025-02-15T11:00:00Z"
}

Health Monitoring

Add Website

POST /api/health/add
Content-Type: application/json

{
    "url": "https://example.com"
}

Response:

{
    "data": {
        "id": "uuid-string",
        "message": "Website added for monitoring"
    }
}

Get Health Status

GET /api/health/status/{id}

Response:

{
    "data": {
        "id": "uuid-string",
        "url": "https://example.com",
        "status": "up",
        "response_time_ms": 150,
        "status_code": 200,
        "ssl_valid": true,
        "uptime_percent": 99.9,
        "check_history": [
            {
                "timestamp": "2025-02-15T10:00:00Z",
                "status": "up",
                "response_time_ms": 150,
                "status_code": 200
            }
        ]
    }
}

Mobile Verification

Verify Number

POST /api/mobile/verify
Content-Type: application/json

{
    "country_code": "+1",
    "phone_number": "2125551234"
}

Response:

{
    "data": {
        "valid": true,
        "phone_number": "2125551234",
        "country_code": "+1"
    }
}

File Protection

Protect File

POST /api/encrypt
Content-Type: multipart/form-data

file: [binary file data]
password: your_password

Response: Protected file binary data with HTTP status 200

Unlock File

POST /api/decrypt
Content-Type: multipart/form-data

file: [protected file data]
password: your_password

Response: Original file binary data with HTTP status 200

Error Responses:

{
    "error": "This file doesn't appear to be a protected file"
}
{
    "error": "Incorrect password or file is corrupted"
}

Error Handling

All API endpoints return appropriate HTTP status codes:

  • 200: Success
  • 400: Bad Request
  • 401: Unauthorized
  • 404: Not Found
  • 429: Too Many Requests
  • 500: Internal Server Error

Error Response Format:

{
    "error": "Error message description"
}

About

A collection of useful web tools including a URL shortener, website health monitor, mobile number verification, and file protection utility.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors