meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| api [2025/06/07 16:09] – c/e wrongecho | api [2025/06/09 15:26] (current) – added "API Reference Guide" dalton | ||
|---|---|---|---|
| Line 61: | Line 61: | ||
| Documentation / an example of how to use a module API endpoint is shown on that module' | Documentation / an example of how to use a module API endpoint is shown on that module' | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ====== API Reference Guide ====== | ||
| + | |||
| + | **Current API v1 Endpoints, Authentication, | ||
| + | |||
| + | ===== Quick Start Guide ===== | ||
| + | |||
| + | ==== Your First API Call in 5 Minutes ==== | ||
| + | |||
| + | - **Generate API Key** | ||
| + | - Login to ITFlow as admin | ||
| + | - Navigate to **Admin > API** | ||
| + | - Click **New Key** | ||
| + | - Choose scope: **All Clients** (for testing) or **Specific Client** | ||
| + | - Copy the generated key | ||
| + | |||
| + | - **Test Connection** | ||
| + | <code bash> | ||
| + | curl " | ||
| + | </ | ||
| + | |||
| + | - **Expected Response** | ||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== API Overview ===== | ||
| + | |||
| + | **Source**: ITFlow official documentation at docs.itflow.org/ | ||
| + | |||
| + | * **Base URL**: ''/ | ||
| + | * **Version**: | ||
| + | * **Authentication**: | ||
| + | * **Response Format**: JSON with '' | ||
| + | * **Pagination**: | ||
| + | * **Content-Type**: | ||
| + | * **Character Encoding**: UTF-8 (utf8mb4 in database) | ||
| + | |||
| + | ==== Standard Response Format ==== | ||
| + | |||
| + | **Source**: ITFlow official API documentation | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Authentication & Security ===== | ||
| + | |||
| + | ==== API Key Management ==== | ||
| + | |||
| + | * **Generation**: | ||
| + | * **Scoping Options**: | ||
| + | * **All Clients**: Full access to all client data | ||
| + | * **Specific Client**: Limited to single client ('' | ||
| + | * **Usage**: Query parameter ''? | ||
| + | * **Security**: | ||
| + | |||
| + | ==== Best Practices ==== | ||
| + | |||
| + | **Source**: MSP community recommendations and security standards | ||
| + | |||
| + | * **Rotate keys** regularly (monthly recommended) | ||
| + | * **Use client-scoped keys** for third-party integrations | ||
| + | * **Store keys securely** (environment variables, not code) | ||
| + | * **Monitor usage** via Apache/PHP logs | ||
| + | * **Use HTTPS only** for all API calls | ||
| + | |||
| + | ===== Currently Available Modules ===== | ||
| + | |||
| + | **Source**: ITFlow official API documentation confirms these modules have API support: | ||
| + | |||
| + | ==== Assets ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Complete Fields** (from ITFlow Assets API Documentation): | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Certificates ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Complete Fields** (from ITFlow Certificates API Documentation): | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Clients ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Complete Fields** (from ITFlow Clients API Documentation): | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | <wrap em>Note: Full field list is partially documented. The API returns numbered keys alongside named keys in the response format.</ | ||
| + | |||
| + | ==== Contacts ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: ITFlow official API documentation lists contacts as supported module | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Available Fields**: Contact table structure includes fields like '' | ||
| + | |||
| + | ==== Credentials ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: ITFlow official API documentation lists credentials (logins) as supported module | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Available Fields**: Database migration scripts confirm '' | ||
| + | |||
| + | ==== Domains ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Complete Fields** (from ITFlow Domains API Documentation): | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Networks ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: ITFlow official API documentation lists networks as supported module | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Available Fields**: Database migration scripts show network interface relationships, | ||
| + | |||
| + | ==== Software ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: ITFlow official API documentation lists software as supported module | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Status**: Module confirmed as available but dedicated documentation page not found. Database includes software table as confirmed by installation scripts. | ||
| + | |||
| + | ==== Tickets ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Complete Fields** (from ITFlow Tickets API Documentation): | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | <wrap em>Note: Full field list is partially documented. The API returns numbered keys alongside named keys in the response format.</ | ||
| + | |||
| + | ===== Current API Capabilities ===== | ||
| + | |||
| + | ==== Standard Operations (All Modules) ==== | ||
| + | |||
| + | * **READ**: Retrieve single record or list of records | ||
| + | * **CREATE**: Add new records with validation (partial support) | ||
| + | * **UPDATE**: Modify existing records (partial support) | ||
| + | * **DELETE**: Remove records (partial support) | ||
| + | |||
| + | ==== Query Parameters (read.php endpoints) ==== | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * API key required on all requests | ||
| + | |||
| + | ==== Response Format (Standardized) ==== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | // Record data with both numbered and named keys | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Current Authentication ===== | ||
| + | |||
| + | ==== API Key Generation ==== | ||
| + | |||
| + | - Navigate to Admin panel in ITFlow | ||
| + | - Click on API section | ||
| + | - Click **New Key** to generate | ||
| + | - Choose scope: specific client or all clients | ||
| + | - Copy generated key for use | ||
| + | |||
| + | ==== API Key Usage ==== | ||
| + | |||
| + | * **Method**: Query parameter | ||
| + | * **Format**: ''? | ||
| + | * **Scope**: Can be limited to specific client or all clients | ||
| + | * **Access**: Currently all-or-nothing permissions | ||
| + | |||
| + | ==== Security Features ==== | ||
| + | |||
| + | * **Encrypted Storage**: API keys stored securely | ||
| + | * **Client Scoping**: Keys can be limited to specific clients | ||
| + | * **Access Logging**: API usage tracked in logs | ||
| + | |||
| + | ===== Current Limitations ===== | ||
| + | |||
| + | ==== Missing CRUD Operations ==== | ||
| + | |||
| + | * **UPDATE**: Limited support across modules | ||
| + | * **DELETE**: Limited support across modules | ||
| + | * **ARCHIVE**: | ||
| + | |||
| + | ==== Missing Advanced Features ==== | ||
| + | |||
| + | * **Bulk Operations**: | ||
| + | * **Advanced Search**: No full-text search or complex filtering | ||
| + | * **Webhooks**: | ||
| + | * **File Upload**: No direct file management API | ||
| + | * **Relationships**: | ||
| + | |||
| + | ==== Missing Business Modules ==== | ||
| + | |||
| + | * **Invoices/ | ||
| + | * **Quotes**: No sales proposal management | ||
| + | * **Time Tracking**: No billable hour recording | ||
| + | * **Calendar**: | ||
| + | * **Reports**: | ||
| + | |||
| + | ==== Authentication Limitations ==== | ||
| + | |||
| + | * **Granular Permissions**: | ||
| + | * **OAuth**: Only API key authentication available | ||
| + | |||
| + | ===== API Usage Examples ===== | ||
| + | |||
| + | ==== Get All Clients ==== | ||
| + | |||
| + | <code bash> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ==== Get Specific Asset ==== | ||
| + | |||
| + | <code bash> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ==== Create New Ticket ==== | ||
| + | |||
| + | <code bash> | ||
| + | POST / | ||
| + | Content-Type: | ||
| + | |||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== List Client Assets ==== | ||
| + | |||
| + | <code bash> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ===== Integration Capabilities ===== | ||
| + | |||
| + | ==== What Works Today ==== | ||
| + | |||
| + | * **Basic CRUD**: Create/read operations for core modules | ||
| + | * **Client Management**: | ||
| + | * **Asset Tracking**: Computer and equipment inventory | ||
| + | * **Ticket Creation**: Help desk ticket automation | ||
| + | * **Documentation**: | ||
| + | |||
| + | ==== What's Missing for Full Automation ==== | ||
| + | |||
| + | * **Financial Operations**: | ||
| + | * **Real-time Events**: No webhook triggers for automation | ||
| + | * **Bulk Data Sync**: No efficient mass data operations | ||
| + | * **File Management**: | ||
| + | * **Advanced Workflows**: | ||
| + | |||
| + | ===== Error Handling & Troubleshooting ===== | ||
| + | |||
| + | ==== Standard Error Codes ==== | ||
| + | |||
| + | **Source**: HTTP standard codes - ITFlow API observed behavior | ||
| + | |||
| + | * **200**: Success - Request completed successfully | ||
| + | * **400**: Bad Request - Invalid parameters or malformed request | ||
| + | * **401**: Unauthorized - Invalid or missing API key | ||
| + | * **403**: Forbidden - API key lacks required permissions | ||
| + | * **404**: Not Found - Endpoint or record doesn' | ||
| + | * **500**: Server Error - Internal ITFlow error | ||
| + | |||
| + | ==== Common Error Messages ==== | ||
| + | |||
| + | **Source**: Observed API responses | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Troubleshooting Steps ==== | ||
| + | |||
| + | **Source**: Community experience and [[https:// | ||
| + | |||
| + | - **API Key Issues** | ||
| + | * Verify key is correct (copy/paste errors common) | ||
| + | * Check key scope (client-specific vs all clients) | ||
| + | * Confirm key hasn't been deactivated | ||
| + | |||
| + | - **Permission Errors** | ||
| + | * Add '' | ||
| + | * Verify client_id exists and is accessible | ||
| + | |||
| + | - **Server Errors** | ||
| + | * Check Apache/PHP error logs: ''/ | ||
| + | * Verify ITFlow database connectivity | ||
| + | * Check PHP memory limits for large requests | ||
| + | |||
| + | - **Data Issues** | ||
| + | * Validate required fields for POST requests | ||
| + | * Check data types (strings, integers, dates) | ||
| + | * Verify foreign key relationships exist | ||
| + | |||
| + | ==== Debug Mode ==== | ||
| + | |||
| + | **Source**: ITFlow admin settings and [[https:// | ||
| + | |||
| + | Enable PHP error reporting in ITFlow settings for detailed error messages during development. | ||
| + | |||
| + | ===== Integration Examples ===== | ||
| + | |||
| + | ==== PowerShell Examples ==== | ||
| + | |||
| + | **Source**: [[https:// | ||
| + | |||
| + | **List All Clients**: | ||
| + | |||
| + | <code powershell> | ||
| + | $apiKey = " | ||
| + | $baseUrl = " | ||
| + | $uri = " | ||
| + | |||
| + | Invoke-RestMethod -Uri $uri | ConvertTo-Json | ||
| + | </ | ||
| + | |||
| + | **Create New Asset**: | ||
| + | |||
| + | <code powershell> | ||
| + | $uri = " | ||
| + | $body = @{ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ConvertTo-Json | ||
| + | |||
| + | Invoke-RestMethod -Method Post -Uri $uri -Body $body -ContentType " | ||
| + | </ | ||
| + | |||
| + | ==== PHP Examples ==== | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | $api_key = ' | ||
| + | $base_url = ' | ||
| + | |||
| + | // Get clients | ||
| + | $url = $base_url . ' | ||
| + | $response = file_get_contents($url); | ||
| + | $data = json_decode($response, | ||
| + | |||
| + | print_r($data); | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | ==== Python Examples ==== | ||
| + | |||
| + | <code python> | ||
| + | import requests | ||
| + | |||
| + | api_key = " | ||
| + | base_url = " | ||
| + | |||
| + | # Get all clients | ||
| + | response = requests.get(f" | ||
| + | data = response.json() | ||
| + | print(data) | ||
| + | |||
| + | # Create new ticket | ||
| + | ticket_data = { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | |||
| + | response = requests.post(f" | ||
| + | result = response.json() | ||
| + | print(result) | ||
| + | </ | ||