To effectively communicate the structure and functionality of your REST API to your frontend team, it's important to provide a clear and detailed description. Here's an outline of your API endpoints with relevant details:
---
### REST API Documentation
#### Base URL
`https://eros-ai.cloud:2096`
#### Common Headers
- **Authorization**: `Bearer {token}` (Required for secured endpoints)
#### Endpoints
1. **POST /sign**
- **Description**: Endpoint for user sign-in.
- **Request Body**:
- `wallet`: User's wallet address.
- `signature`: Signature for authentication.
- `timestamp`: Current timestamp.
- **Response**:
- `status`: Operation status.
- `token`: JWT token for session management.
2. **GET /demoSignature**
- **Description**: Provides a demo signature for testing.
- **Response**:
- `status`: Operation status.
- `timestamp`: Timestamp of the signature.
- `wallet`: Wallet address.
- `signature`: Generated signature.
3. **GET /telegramToken**
- **Description**: Retrieves a token for Telegram account linking.
- **Response**:
- `wallet`: Wallet address.
- `token`: Generated token for Telegram linking.
- `human`: Instructions for linking Telegram account.
4. **GET /telegramUser**
- **Description**: Fetches Telegram user information.
- **Response**:
- `wallet`: Wallet address.
- `user_id`: Telegram user ID.
- `username`: Telegram username.
5. **POST /submitTelegram**
- **Description**: Submits Telegram information.
- **Request Body**:
- `user_id`: User ID.
- `username`: Telegram username.
- **Response**:
- `status`: Operation status.
6. **GET /user**
- **Description**: Retrieves user information.
- **Query Parameters**:
- `user_id`: User ID.
- **Response**:
- `user_id`: User ID.
- `wallet`: User's wallet address.
- `telegram`: Telegram details.
7. **GET /referralLink**
- **Description**: Fetches referral link information.
- **Query Parameters**:
- `user_id`: User ID.
- `type`: Type of referral link ("client" or "partner").
- **Response**:
- `id`: Referral link ID.
- `referral_code`: Referral code.
- `referral_link`: Actual referral link.
8. **GET /affiliateStats**
- **Description**: Provides affiliate statistics.
- **Query Parameters**:
- `user_id`: User ID.
- **Response**:
- `sales_amount`: Total sales amount in ETH.
- `sales_number`: Number of sales.
- `partner_income`: Income from partners in ETH.
- `partners_number`: Number of partners.
9. **GET /paymentsHistory**
- **Description**: Retrieves payment history.
- **Response**:
- `payments`: Array of payment records, each containing:
- `id`: Payment ID.
- `user_id`: User ID.
- `wallet`: Wallet address.
- `username`: Username.
- `shown_name`: Display name.
- `date`: Date of payment.
- `partner_id`: Partner's ID.
- `partner_wallet`: Partner's wallet address.
- `partner_username`: Partner's username.
- `partner_shown_name`: Partner's display name.
- `amount`: Amount in ETH.
- `type`: Type of transaction.
- `income`: Income in ETH.
---
### Notes for Frontend Team
- All API calls should be made asynchronously.
- Ensure proper error handling for each endpoint.
- Use JWT token from `/sign` endpoint for other secured endpoints.
- Validate and sanitize inputs where applicable.
- UI should reflect loading states during API calls.
- Implement user-friendly error messages based on API responses.
---
This documentation provides an overview of your backend API, outlining the available endpoints, expected request formats, and typical responses. Ensure that your frontend team is aware of any specific requirements or constraints related to each endpoint.