Hoax Detection For Everyone (HOFE)

API untuk mendeteksi berita palsu dan memberikan informasi akurat

Tentang API

API ini memungkinkan pengguna untuk melakukan pendaftaran, login, logout, serta verifikasi apakah berita yang diberikan adalah hoaks atau tidak. Pengguna dapat mengakses berita hoaks terbaru dan melakukan prediksi melalui artikel berita menggunakan URL atau teks.

Domain API: https://api-cc-hofe.vercel.app/

User Registration

POST /api/user/register

Request Body

{
  "username": "your_username",
  "email": "your_email@example.com",
  "password": "your_password"
}
                    

Response

{
  "statusCode": 201,
  "message": "User created successfully."
}
                    

Contoh cURL

curl -X POST https://api-cc-hofe.vercel.app/api/user/register \
  -H "Content-Type: application/json" \
  -d '{"username": "your_username", "email": "your_email@example.com", "password": "your_password"}'
                    

User Login

POST /api/user/login

Request Body

{
  "username": "your_username",
  "password": "your_password"
}
                    

Response

{
  "statusCode": 200,
  "message": "Login successful.",
  "access_token": "your_access_token"
}
                    

Contoh cURL

curl -X POST https://api-cc-hofe.vercel.app/api/user/login \
  -H "Content-Type: application/json" \
  -d '{"username": "your_username", "password": "your_password"}'
                    

Get News (Hoax)

GET /api/news

Headers

{
  "Authorization": "Bearer "
}
        

Response

[
  {
    "title": "SMP Student Kills Friend in Violent Attack",
    "link": "https://turnbackhoax.id/2024/11/24/salah-siswa-smp-aniaya-teman-hingga-tewas/",
    "date": "November 24, 2024",
    "image": "https://turnbackhoax.id/wp-content/uploads/2024/11/WhatsApp-Image-2024-11-24-at-17.43.57-326x245.jpeg",
    "content": "In reality, the victim is still alive and just unconscious during the incident.",
    "category": "Hoax"
  },
  ...
]
        

Contoh cURL

curl -X GET https://api-cc-hofe.vercel.app/api/news -H "Authorization: Bearer "
        

Predict News (Text)

POST /api/news/predict/text

Request Body

{
  "text": "Example news text that needs to be validated"
}
                    

Response

{
  "statusCode": 200,
  "prediction": "Valid",  // or "Invalid" for hoax news
  "text": "Example news text"
}
                    

Contoh cURL

curl -X POST https://api-cc-hofe.vercel.app/api/news/predict/text \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{"text": "Example news text"}'
                    

Predict News (URL)

POST /api/news/predict/url

Request Body

{
  "url": "string"  // URL of the news to be predicted
}
        

Response

{
  "statusCode": 200,
  "prediction": "Valid",  // or "Invalid" for hoax news
  "text": "example news text"
}
        

Contoh cURL

curl -X POST https://api-cc-hofe.vercel.app/api/news/predict/url \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{"url": "news-url"}'
        

User Profile

GET /api/user/profile

Response

{
  "username": "your_username",
  "email": "your_email@example.com"
}
                    

Contoh cURL

curl -X GET https://api-cc-hofe.vercel.app/api/user/profile -H "Authorization: Bearer "