Skip to content

Latest commit

Β 

History

History
156 lines (115 loc) Β· 2.11 KB

File metadata and controls

156 lines (115 loc) Β· 2.11 KB

πŸ“˜ SentiLog-AI API Documentation

This file contains REST API documentation for both the Express Server (Node.js) and the ML API (Flask).


🌐 Server API

πŸ“Œ POST /api/news/analyze

Description: Analyze the sentiment and political bias of a news article.

Request Body:

{
  "title": "News headline",
  "content": "Full news article content"
}

Response:

{
  "bias": "Left",
  "sentiment": "Negative"
}

πŸ“Œ POST /api/journal/analyze

Description: Analyze the emotional tone of a journal entry.

Request Body:

{
  "entry": "I felt anxious after reading today's headlines."
}

Response:

{
  "emotion": "Anxious",
  "score": -0.6
}

πŸ“Œ GET /api/news

Description: Fetch all stored news articles.

Response:

[
  {
    "title": "Market is booming",
    "sentiment": "Positive",
    "source": "Reuters"
  }
]

πŸ“Œ POST /api/journal

Description: Save a new journal entry.

Request Body:

{
  "text": "I had a productive day."
}

Response:

{
  "sentiment": "Positive"
}

πŸ“Œ POST /api/contact

Description: Submit a contact message.

Request Body:

{
  "name": "John Doe",
  "email": "john@example.com",
  "message": "I love your project!"
}

Response:

{
  "success": true,
  "message": "Contact message sent successfully."
}

🧠 ML API

πŸ“Œ POST /predict

Description: Analyze custom text using ML model and return sentiment + emotion.

Request Body:

{
  "text": "I am feeling hopeful today!"
}

Response:

{
  "sentiment": "Positive",
  "emotion": "Happy"
}

βœ… Status Codes

Code Description
200 Success
400 Bad Request
404 Not Found
500 Internal Server Error

πŸ”— Swagger UI

Access Swagger docs after starting server:

http://localhost:8080/api-docs

This document will grow as new endpoints are added.