API Documentation

Reference for developers and external integrations

Reference
Base URL
http://127.0.0.1:5000 (Localhost)
Authentication & Users
POST Login (Get Token)
curl -X POST http://127.0.0.1:5000/api/v1/login \
  -H "Content-Type: application/json" \
  -d '{ "username": "admin", "password": "admin" }'

POST Register New App User
curl -X POST http://127.0.0.1:5000/api/v1/register \
  -H "Content-Type: application/json" \
  -d '{ "username": "john_doe", "password": "secret123" }'

GET Reset Default Admin (Debug)

Forces recreation of admin/admin if login fails.

curl -X GET http://127.0.0.1:5000/debug/reset_admin
Product Catalog (TMF620)

Protected: Requires Bearer Token

GET List Products
curl -X GET http://127.0.0.1:5000/api/v1/productCatalog \
  -H "Authorization: Bearer <YOUR_TOKEN>"

POST Create Product
curl -X POST http://127.0.0.1:5000/api/v1/productCatalog \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "name": "Corporate 5G", "description": "Enterprise", "price": 120.00 }'
Customers (TMF629)

Protected: Requires Bearer Token

GET List Customers
curl -X GET http://127.0.0.1:5000/api/v1/customer \
  -H "Authorization: Bearer <YOUR_TOKEN>"

POST Create Customer
curl -X POST http://127.0.0.1:5000/api/v1/customer \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "name": "John Doe", "email": "john@example.com" }'
Order Management (TMF622)

Protected: Requires Bearer Token

GET List Orders
curl -X GET http://127.0.0.1:5000/api/v1/productOrder \
  -H "Authorization: Bearer <YOUR_TOKEN>"

POST Place Order
curl -X POST http://127.0.0.1:5000/api/v1/productOrder \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "customerId": "UUID_HERE", "productId": "UUID_HERE" }'
Note: If Kafka is offline, use Fulfill Demo below to complete orders.

POST Force Order Fulfillment (Demo)
curl -X POST http://127.0.0.1:5000/api/v1/fulfill_now_demo \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "orderId": "UUID_HERE" }'
Service Inventory (TMF638)

Protected: Requires Bearer Token

GET List Active Services
curl -X GET http://127.0.0.1:5000/api/v1/service \
  -H "Authorization: Bearer <YOUR_TOKEN>"

POST Terminate Service & Release Resource
Action: Sets service to 'Terminated' and returns Resource to pool.
curl -X POST http://127.0.0.1:5000/api/v1/service/{serviceId}/terminate \
  -H "Authorization: Bearer <YOUR_TOKEN>"
Resource Management (Physical Stock)

Protected: Requires Bearer Token

POST Add Stock (User Input)
Note: Allows adding physical SIM cards to the pool dynamically. Increases the Total count in the Utilization chart.
curl -X POST http://127.0.0.1:5000/api/v1/resources/add \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "count": 10, "type": "SIM" }'
Billing & Usage

Protected: Requires Bearer Token

GET List Invoices
curl -X GET http://127.0.0.1:5000/api/v1/billing \
  -H "Authorization: Bearer <YOUR_TOKEN>"
GET Download Invoice (PDF)
curl -X GET http://127.0.0.1:5000/api/v1/billing/{invoice_id}/download \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  --output invoice_{invoice_id}.pdf
POST Generate Invoice
curl -X POST http://127.0.0.1:5000/api/v1/billing \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "customerId": "UUID_HERE" }'
POST Report Usage
curl -X POST http://127.0.0.1:5000/api/v1/usage \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{ "serviceId": "UUID_HERE", "amount": 500 }'
Analytics (Market Reqs)
Catalog Performance
curl -X GET http://127.0.0.1:5000/api/v1/stats/catalog
Response Example:
{
  "labels": ["5G Premium", "Basic Mobile"],
  "data": [10, 5]
}
Revenue Trend
curl -X GET http://127.0.0.1:5000/api/v1/stats/revenue
Response Example:
{
  "labels": ["2024-02-01", "2024-02-02"],
  "data": [150.50, 220.00]
}
Order Lifecycle
curl -X GET http://127.0.0.1:5000/api/v1/stats/orders
Response Example:
{
  "labels": ["Acknowledged", "Completed"],
  "data": [2, 10]
}
ARPU (Rev per User)
curl -X GET http://127.0.0.1:5000/api/v1/stats/arpu
Response Example:
{
  "arpu": 45.50
}
Resource Utilization
curl -X GET http://127.0.0.1:5000/api/v1/stats/resources
Response Example:
[
  {
    "type": "SIM",
    "percentage": 50.0,
    "total": 20,
    "used": 10
  }
]
System & OSS Integration
POST Initialize Demo Data
curl -X POST http://127.0.0.1:5000/setup/init

GET Retroactive Service Sync (Utility)

Scans completed orders missing service inventory and creates them.

curl -X GET http://127.0.0.1:5000/sync_services

GET Force Sync Resources (Debug)

Fixes 0.0% usage by force-linking Active Services to Free Resources.

curl -X GET http://127.0.0.1:5000/force_sync_resources

POST OSS Callback (External)
curl -X POST http://127.0.0.1:5000/api/oss/callback \
  -H "Content-Type: application/json" \
  -d '{ 
    "serviceOrderId": "so-123", 
    "serviceSpecId": "spec-123", 
    "customerId": "cust-123", 
    "po_id": "po-123" 
  }'

This endpoint is called by the Network Management System (OSS) when provisioning is complete.