API Reference
Complete reference documentation for the WTicket JavaScript API.
API Reference
Overview
The WTicket API is exposed through the API object exported from js/app.js.
All methods return Promises for asynchronous operation.
import API from './js/app.js';
// Usage example
const session = await API.login('user@example.com', 'password123');
Module Structure
The API is organized into the following functional modules:
Module |
Description |
|---|---|
Authentication |
Login, logout, session management |
User Management |
Registration, profile updates |
Ticket Operations |
CRUD operations for tickets |
Query Functions |
Data retrieval and filtering |
Utility Functions |
Formatting, escaping, date handling |
Base Configuration
The API connects to JSONBin.io for data persistence:
const JSONBIN_BASE_URL = 'https://api.jsonbin.io/v3';
const JSONBIN_API_KEY = 'your-master-key';
Error Handling
All API methods throw errors on failure. Wrap calls in try-catch blocks:
try {
const session = await API.login(email, password);
console.log('Login successful:', session);
} catch (error) {
console.error('Login failed:', error.message);
}