API Documentation for User Management System

This document provides a comprehensive overview of the available API endpoints for the User Management System. These endpoints enable functionalities such as user registration, login, email verification, password recovery, and token refresh.


Base URL

The base URL for all API endpoints is:

http://<your-server-address>

Replace <your-server-address> with the actual server address during implementation.


Endpoints

1. Register User

POST auth/register

Registers a new user in the system.

Request Body (JSON):

{
  "username": "string",
  "email": "string",
  "password": "string"
}

Response:

2. Confirm Email

GET auth/confirm/<token>

Verifies the user's email address using the provided token.

URL Parameters:

Response:

3. Forgot Password

POST auth/forgot-password

Sends a password reset link to the user's registered email address.

Request Body (JSON):

{
  "email": "string"
}

Response:

2. Get Dashboard Data

GET /dashboard

Fetches dashboard data for the authenticated user, including project information.

Authorization:

This endpoint requires a valid JWT token for authentication.

Response:

Response Body (JSON):

{
  "dashboard": [
    {
      "project_name": "string",
      "num_keywords": "integer",
      "num_competitors": "integer"
    }
  ]
}

1. Get or Update Project

GET /api/projects/<project_id>

Retrieves the details of a project for the authenticated user.

PUT /api/projects/<project_id>

Updates the details of a project for the authenticated user.

URL Parameters:

Request Body (PUT only):

Response:

GET:

PUT:

3. Create Project

POST /api/projects

Creates a new project for the authenticated user.

Authorization:

This endpoint requires a valid JWT token for authentication.

Request Body (JSON):

{
  "name": "string",
  "myket_url": "string",
  "bazar_url": "string",
  "googleplay_url": "string",
  "keywords": ["string", "string"],
  "competitors_urls": ["string", "string"]
}

Response:

Response Body (JSON):

{
  "message": "Project created successfully",
  "project_id": "integer"
}

4. Reset Password

POST auth/reset-password/<token>

Allows the user to reset their password using a reset token.

URL Parameters:

Request Body (JSON):

{
  "password": "string"
}

Response:

5. Login

POST auth/login

Authenticates a user and generates access and refresh tokens.

Request Body (JSON):

{
  "email": "string",
  "password": "string"
}

Response:

Response Example:

{
  "access_token": "string",
  "refresh_token": "string"
}

6. Refresh Token

POST /refresh

Generates a new access token using the provided refresh token.

Headers:

Response:

Response Example:

{
  "access_token": "string"
}

7. Health Check

GET /health

Confirms the API is operational.

Response:

1.bazaar Daily Stars

POST /bazaar_daily_stars

Retrieves the daily star rating changes for a specific app over a given number of days.

Request Body (JSON):

{
  "url": "string",  // Required: The unique URL of the app
  "days": "integer" // Optional: Number of days to calculate changes (default: 30)
}

Response:


Token Expiration


Security Notes

  1. Use HTTPS: Always encrypt communication using HTTPS.
  2. Secure Storage: Store access and refresh tokens securely on the client side.
  3. Email Validation: Ensure email formats are validated before making requests.
  4. Rate Limiting: Implement rate limiting to protect against abuse.

For additional questions or support, please contact the backend development team.