Welcome to Your Dashboard

Manage your API keys and explore the documentation

Your API Key

Use this API key to authenticate your requests to protected endpoints.

Loading...

API Documentation

Authentication

Include your API key in all requests using the x-api-key header.

Authentication Endpoints

POST https://uasapibe-production.up.railway.app/api/auth/register

Register a new user account

Request Body:
{
  "username": "john_doe",
  "email": "john@example.com",
  "password": "secure_password",
  "role": "pelanggan"
}
Response:
{
  "message": "User registered successfully",
  "token": "jwt_token_here",
  "user": {
    "id": 1,
    "username": "john_doe",
    "email": "john@example.com",
    "role": "pelanggan"
  }
}
POST https://uasapibe-production.up.railway.app/api/auth/login

Login with existing credentials

Request Body:
{
  "username": "john_doe",
  "password": "secure_password"
}
Response:
{
  "message": "Login successful",
  "token": "jwt_token_here",
  "user": {
    "id": 1,
    "username": "john_doe",
    "email": "john@example.com",
    "role": "pelanggan"
  }
}

Menu Endpoints (Protected)

GET https://uasapibe-production.up.railway.app/api/menu

Get all menu items

Headers:
{
  "x-api-key": "your-api-key"
}
Response:
[
  {
    "id": 1,
    "nama": "Nasi Goreng",
    "harga": 25000,
    "gambar": "nasi_goreng.jpg",
    "jumlah": 10,
    "id_kategori": 1,
    "id_user": 1,
    "kategori": {
      "id_kategori": 1,
      "nama_kategori": "Makanan Utama"
    },
    "user": {
      "id_user": 1,
      "username": "admin",
      "email": "admin@example.com",
      "role": "admin"
    }
  }
]
GET https://uasapibe-production.up.railway.app/api/menu/:id

Get menu item by ID

Parameters:

id - The ID of the menu item

Headers:
{
  "x-api-key": "your-api-key"
}
POST https://uasapibe-production.up.railway.app/api/menu

Create a new menu item

Headers:
{
  "x-api-key": "your-api-key"
}
Request Body:
{
  "nama": "Nasi Goreng",
  "harga": 25000,
  "gambar": "nasi_goreng.jpg",
  "jumlah": 10,
  "id_kategori": 1,
  "id_user": 1
}
PUT https://uasapibe-production.up.railway.app/api/menu/:id

Update a menu item

Headers:
{
  "x-api-key": "your-api-key"
}
Request Body:
{
  "nama": "Nasi Goreng Spesial",
  "harga": 30000
}
DELETE https://uasapibe-production.up.railway.app/api/menu/:id

Delete a menu item

Headers:
{
  "x-api-key": "your-api-key"
}

Category Endpoints

GET https://uasapibe-production.up.railway.app/api/kategori

Get all categories

Response:
[
  {
    "id_kategori": 1,
    "nama_kategori": "Makanan Utama"
  }
]
GET https://uasapibe-production.up.railway.app/api/kategori/:id

Get category by ID

Parameters:

id - The ID of the category

POST https://uasapibe-production.up.railway.app/api/kategori

Create a new category

Request Body:
{
  "nama_kategori": "Minuman"
}

Order Endpoints

GET https://uasapibe-production.up.railway.app/api/orders

Get all orders

Response:
[
  {
    "id": 1,
    "user_id": 1,
    "total_amount": 50000,
    "status": "pending",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
]
POST https://uasapibe-production.up.railway.app/api/orders

Create a new order

Request Body:
{
  "user_id": 1,
  "total_amount": 50000,
  "items": [
    {
      "menu_id": 1,
      "quantity": 2,
      "price": 25000
    }
  ]
}
PUT https://uasapibe-production.up.railway.app/api/orders/:id/status

Update order status

Request Body:
{
  "status": "completed"
}

Payment Endpoints

GET https://uasapibe-production.up.railway.app/api/payment

Get all payments

Response:
[
  {
    "id": 1,
    "order_id": 1,
    "amount": 50000,
    "payment_method": "cash",
    "status": "completed",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
]
POST https://uasapibe-production.up.railway.app/api/payment

Create a new payment

Request Body:
{
  "order_id": 1,
  "amount": 50000,
  "payment_method": "cash"
}
PUT https://uasapibe-production.up.railway.app/api/payment/:id/status

Update payment status

Request Body:
{
  "status": "completed"
}

User Endpoints

GET https://uasapibe-production.up.railway.app/api/users

Get all users

Response:
[
  {
    "id_user": 1,
    "username": "john_doe",
    "email": "john@example.com",
    "role": "pelanggan"
  }
]
GET https://uasapibe-production.up.railway.app/api/users/me

Get current user profile

Headers:
{
  "Authorization": "Bearer your-jwt-token"
}
GET https://uasapibe-production.up.railway.app/api/users/:id

Get user by ID

Parameters:

id - The ID of the user

Error Responses

All endpoints may return the following error responses:

401 Unauthorized

Missing or invalid API key

{
  "error": "API key required"
}
403 Forbidden

Invalid or inactive API key

{
  "error": "Invalid or inactive API key"
}
404 Not Found

Resource not found

{
  "error": "Menu not found"
}
500 Internal Server Error

Server error

{
  "error": "Failed to fetch menu items"
}