FishApp API Documentation

Base URL: http://fishapp.qzenselabs.com

Authentication Endpoints

POST /auth/login/

Description: Log in a user.

Headers: Content-Type: application/json

JSON Body:

{
  "username": "john_doe", 
  "password": "secretPassword",
  "phone_number": "1234567890"
}

POST /auth/signup/

Description: Create a new user account. (phone_number is preferred)

Headers: Content-Type: application/json

JSON Body:

{
  "username": "john_doe", 
  "password": "secretPassword",
  "phone_number": "1234567890",
  "email": "john@example.com"
}

POST /auth/verify/

Description: Verify the OTP sent during signup.

Headers: Content-Type: application/json

JSON Body:

{
  "otp": "123456"
}

POST /auth/forgot-password/

Description: Initiate password reset by sending an OTP to the user’s phone number.

Headers: Content-Type: application/json

JSON Body: (phone_number and username required)

{
  "username": "john_doe",
  "phone_number": "1234567890"
}

POST /auth/reset-password/

Description: Reset password using OTP verification.

Headers: Content-Type: application/json

JSON Body:

{
  "username": "john_doe",
  "otp": "123456",
  "new_password": "newSecretPassword"
}

GET /auth/user-details/

Description: Retrieve details of the authenticated user.

Headers: Authorization: Bearer <token>

GET http://fishapp.qzenselabs.com/auth/user-details/

POST /auth/update-email/

Description: Update the user's email address (two-step process).

Step 1 JSON Body:

{
  "new_email": "new@example.com",
  "phone_number": "1234567890"
}

Step 2 JSON Body:

{
  "new_email": "new@example.com",
  "otp": "123456",
  "phone_number": "1234567890"
}

POST /auth/delete/

Description: Delete a user. The authenticated user can delete their account by providing their username.

Headers: Content-Type: application/json, Authorization: Bearer <token>

JSON Body:

{
  "username": "john_doe"
}

POST /auth/forgot-username/

Description: Request an OTP to retrieve the username using the registered phone number.

Headers: Content-Type: application/json

{
  "phone_number": "1234567890"
}

POST /auth/reset-username/

Description: Reset username (two-step process using phone_number).

Step 1 JSON Body:

{
  "phone_number": "1234567890"
}

Step 2 JSON Body:

{
  "phone_number": "1234567890",
  "otp": "123456",
  "new_username": "new_john"
}

Data & Machine Learning Endpoints

POST /post/

Description: Process a DL/ML prediction request.

Note: The parameter part determines the branch:
- If part is gills, the DL/ML prediction branch is executed.
- If part is body and FishName is provided (e.g. "mackerel" or "sardine"), the fish detection branch is executed.

Headers: Authorization: Bearer <token>

Example 1: Gills Branch

Body Type: multipart/form-data

Form-data Fields:

POST http://fishapp.qzenselabs.com/post/
Headers:
  Authorization: Bearer <token>
Body (form-data):
  deviceModel: "XYZ"
  brand: "ABC"
  test: "sample"
  mlModel: "banana"
  part: "gills"
  hour: "12"
  flash: "yes"
  phone_number: "1234567890"
  capture: [Select image file]

Example 2: Fish Detection Branch

Usage: Set part to "body" and include the FishName parameter (e.g., "mackerel" or "sardine").

Form-data Fields:

POST http://fishapp.qzenselabs.com/post/
Headers:
  Authorization: Bearer <token>
Body (form-data):
  deviceModel: "XYZ"
  brand: "ABC"
  test: "sample"
  mlModel: "any"
  part: "body"
  FishName: "mackerel"
  hour: "12"
  flash: "no"
  phone_number: "1234567890"
  capture: [Select image file]

POST /feedback/

Description: Submit feedback on a prediction result.

Headers: Content-Type: application/json, Authorization: Bearer <token>

JSON Body: (include phone_number if applicable)

{
  "f1_actual": "Good",
  "f2_actual": "Bad",
  "f3_actual": "Good",
  "phone_number": "1234567890"
}

POST /tomato/

Description: Process a tomato image for detection.

Headers: Authorization: Bearer <token>

Body Type: multipart/form-data

Form-data: capture (file: tomato image)

POST http://fishapp.qzenselabs.com/tomato/
Headers:
  Authorization: Bearer <token>
Body (form-data):
  capture: [Select tomato image file]

POST /detection/

Description: Perform object detection on an image.

Headers: Authorization: Bearer <token>

Body Type: multipart/form-data

Form-data: capture (file: image)

POST http://fishapp.qzenselabs.com/detection/
Headers:
  Authorization: Bearer <token>
Body (form-data):
  capture: [Select image file]