This endpoint allows you to check if the API service is operational. It is useful for monitoring tests or system status checks.
Authentication
This endpoint requires authentication with a valid user session.
Response
Indicates whether the service is operational
Message indicating the service status
200 OK
{
"success": true,
"message": "Service operational",
"timestamp": "2023-09-15T14:32:45Z",
"version": "1.0.2"
}
503 Service Unavailable
{
"success": false,
"message": "Service temporarily unavailable",
"timestamp": "2023-09-15T14:32:45Z"
}
Example Usage
// Available URLs:
// - Local development: http://localhost:3000/api/account/test
// - Alternative local: http://localhost:3001/api/account/test
// - Production: https://onlyautomator.com/api/account/test
// Example: Check the service status
const checkServiceStatus = async () => {
try {
const baseUrl = 'http://localhost:3000'; // or 'https://onlyautomator.com'
const response = await fetch(`${baseUrl}/api/account/test`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
if (data.success) {
console.log(`Service operational. Version: ${data.version}`);
} else {
console.log(`Service unavailable: ${data.message}`);
}
return data.success;
} catch (error) {
console.error('Error checking service status:', error);
return false;
}
};
// Usage in a monitoring system
const monitorService = () => {
// Check every 5 minutes
setInterval(async () => {
const isOperational = await checkServiceStatus();
if (!isOperational) {
// Alert administrator
sendAlert('The API service is unavailable!');
}
}, 5 * 60 * 1000);
};
Usage Notes
- This endpoint can be used for service availability checks
- It can also be used to confirm that an authentication is valid
- Useful for monitoring systems and service health checks