Skip to content

Latest commit

 

History

History
117 lines (93 loc) · 1.77 KB

API_DOCUMENTATION.md

File metadata and controls

117 lines (93 loc) · 1.77 KB

KlipTopia API Documentation

Authentication

Login

  • Endpoint: POST /api/auth/login

  • Description: Authenticate and obtain an access token.

  • Request:

    • Body:

      {
          "username": "user@example.com",
          "password": "securepassword"
      }
  • Response:

    • Success (200 OK):

      {
          "message": "success",
          "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
      }
    • Error (401 Unauthorized):

      {
          "message": "Invalid credentials"
      }

Logout

  • Endpoint: POST /api/auth/logout
  • Description: Invalidate the current access token.
  • Request:
    • Headers:
      • Authorization: Bearer [token]
  • Response:
    • Success (200 OK):

      {
          "message": "Logout successful"
      }

Register

  • Endpoint: POST /api/auth/register

  • Description: Create a new user account.

  • Request:

    • Body:

      {
          "username": "newuser",
          "email": "newuser@example.com",
          "password": "securepassword"
      }
  • Response:

    • Success (201 Created):

      {
          "message": "User registered successfully"
      }
    • Error (400 Bad Request):

      {
          "message": "Validation failed"
      }

Clipboard

Copy

  • Endpoint: POST /api/clipboard/copy

  • Description: Copy content to the clipboard.

  • Request:

    • Headers:

      • Authorization: Bearer [token]
    • Body:

      {
          "deviceIpAddress":"127.0.0.1",
          "content":"content",
          "contentType":"text"
      }
  • Response:

    • Success (200 OK):

      {
          "message":"content published"
      }
    • Error (401 Unauthorized):

      {
          "message": "Unauthorized"
      }