**API Documentation for Telegram Bot Integration with HiParkV**

Overview

This document describes the RESTful API for integrating a Telegram bot with the HiParkV parking management system, enabling car license plate validation and discount application.

Base URL
[https://[server]:[port]/api/validator/](https://[server]:[port]/api/validator/)

Authentication
All API requests require an API key passed in the request body:
{  "API_KEY": "your_api_key_here" }

Endpoints
**1. Validate License Plate**
Checks if a vehicle with the specified license plate is currently in the parking.
**Endpoint:** **/validate**  
**Method:** **POST**
| Request<br>{<br>  "API_KEY": "your_api_key_here",<br>  "PlateNumber": "ABC123",<br>  "UID": "validator_device_identifier"<br>}<br><br><br> | Response<br>**Success (200 OK)**<br>{<br>  "Present": true,<br>  "VehicleInfo": {<br>    "PlateNumber": "ABC123",<br>    "CheckInTimeStamp": "2025-03-07T14:30:00Z",<br>    "ClientGroup": "1",<br>    "NextTimeSlice": "2025-03-07T15:30:00Z",<br>    "CurrentFee": "500"<br>  },<br>  "ErrorDescription": null<br>}<br><br><br>**Not Found (404 Not Found)**<br>{<br>  "Present": false,<br>  "VehicleInfo": null,<br>  "ErrorDescription": "Plate not found"<br>}<br><br><br>**Bad Request (400 Bad Request)**<br>"Invalid request: Plate number required"<br><br><br> |
| --- | --- |

  

**2. Apply Time-Based Discount**
A time discount (in minutes) applies to a vehicle's parking fee.
**Endpoint:** **/discount/time**  
**Method:** **POST**
| Request<br>{<br>  "API_KEY": "your_api_key_here",<br>  "PlateNumber": "ABC123",<br>  "DiscountMinutes": 60,<br>  "UID": "validator_device_identifier"<br>}<br><br><br> | Response<br>**Success (200 OK)**<br>{<br>  "Successful": true,<br>  "NewFee": 300,<br>  "ErrorDescription": null<br>}<br><br><br>**Not Found (404 Not Found)**<br>{<br>  "Successful": false,<br>  "NewFee": 0,<br>  "ErrorDescription": "Failed to apply discount"<br>}<br>**Bad Request (400 Bad Request)**<br>"Invalid request: Plate number and discount minutes required"<br><br><br> |
| --- | --- |

**3. Apply Monetary Discount**
Applies a monetary discount amount to a vehicle's parking fee.
**Endpoint:** **/discount/sum**  
**Method:** **POST**
| Request<br>{<br>  "API_KEY": "your_api_key_here",<br>  "PlateNumber": "ABC123",<br>  "DiscountAmount": 200,<br>  "UID": "validator_device_identifier"<br>}<br><br><br> | Response<br>**Success (200 OK)**<br>{<br>  "Successful": true,<br>  "NewFee": 300,<br>  "ErrorDescription": null<br>}<br><br><br>**Not Found (404 Not Found)**<br>{<br>  "Successful": false,<br>  "NewFee": 0,<br>  "ErrorDescription": "Failed to apply discount"<br>}<br>**Bad Request (400 Bad Request)**<br>"Invalid request: Plate number and discount amount required"<br><br><br> |
| --- | --- |

  

**Error Codes**
| Status Code | Description | |-------------|-------------| | 200 | Success - The request was successful | | 400 | Bad Request - Missing or invalid parameters | | 401 | Unauthorized - Invalid API key | | 404 | Not Found - Vehicle not found or discount application failed | | 405 | Method Not Allowed - Only POST method is supported | | 500 | Internal Server Error - Server encountered an error |

**Example Usage Workflow**
1.       User inputs license plate in Telegram bot
2.       Bot calls **/validate** endpoint to verify vehicle presence
3.       If the vehicle is found, bot displays current fee and options for discount
4.       User selects discount type (time or monetary) and amount
5.       Bot calls an appropriate endpoint (**/discount/time** or **/discount/sum**)
6.       Bot displays confirmation and updated fee to user

This API enables Telegram bots to seamlessly integrate with the HiParkV parking system, providing a convenient way for authorized personnel to validate vehicles and apply discounts remotely.