API Documentation
Complete guide to using the Ticket Field Detection API
Overview
The Ticket Field Detection API allows you to automatically detect and classify ticket fields based on ticket subject text. The API analyzes keywords in your subject line and returns the matching service, category, group, and item type.
Base URL: http://your-domain/api
Authentication: API Key + API Secret (via headers)
Authentication
All API requests must include two headers with your credentials:
Getting Your Credentials: Generate API keys from the API Keys page in the management panel.
Note: Keep your API Secret confidential. If compromised, regenerate it immediately from the API Keys page.
Endpoints
Detect Ticket Fields
Analyze ticket subject and get field recommendations
Request Headers
Request Body
Response (Success)
Response (No Match)
Response Fields
success
Boolean indicating if a match was found
match_type
Type of match: "keyword_match", "phrase_match", or "fuzzy_match"
service_id, service_name
The matched service information
category_id, category_name, category_description
The matched category information
group_id, group_name
The assigned support group
item_type_id, item_type_name
The ticket item type classification
Get Available Options
Retrieve all available services, categories, and keywords
Returns all services, categories, and keywords that can be used for detection.
Get API Statistics
Retrieve API usage statistics
Returns API usage statistics including total requests and match rates.
HTTP Status Codes
200 OK
Request successful (match found or not)
400 Bad Request
Missing or invalid parameters
401 Unauthorized
Missing or invalid API credentials
500 Internal Server Error
Server error during processing
Code Examples
JavaScript / Fetch
const response = await fetch('/api/detect-fields', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your_api_key',
'X-API-Secret': 'your_api_secret'
},
body: JSON.stringify({
subject: 'sap access issue'
})
});
const data = await response.json();
if (data.success) {
console.log('Service:', data.service_name);
console.log('Category:', data.category_name);
}
PHP / cURL
$ch = curl_init('http://your-domain/api/detect-fields');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['subject' => 'sap issue']),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: your_api_key',
'X-API-Secret: your_api_secret'
]
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
if ($data['success']) {
echo "Service: " . $data['service_name'];
}
Python / Requests
import requests
import json
url = 'http://your-domain/api/detect-fields'
headers = {
'Content-Type': 'application/json',
'X-API-Key': 'your_api_key',
'X-API-Secret': 'your_api_secret'
}
payload = {
'subject': 'sap access issue'
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
if data['success']:
print(f"Service: {data['service_name']}")
print(f"Category: {data['category_name']}")
Best Practices
Use Descriptive Subjects
Include keywords related to the issue (e.g., "sap access", "network connectivity") for better detection accuracy.
Handle Failed Matches
Always check the "success" field. If no match is found, provide a fallback category or prompt for manual selection.
Implement Error Handling
Handle HTTP errors (401, 400, 500) gracefully. Implement retry logic for transient failures.
Secure Your Credentials
Store API credentials in environment variables, never hardcode them. Regenerate secrets if compromised.
Support
For issues or questions about the API, please refer to the API Keys page for management, or test the API using the API Tester.