wulf-pulse/app/api/rmm-test/route.ts

33 lines
935 B
TypeScript
Raw Normal View History

import { NextRequest, NextResponse } from 'next/server';
import { getDattoRMMClient } from '@/lib/services/datto-rmm-factory';
export async function GET(request: NextRequest) {
try {
console.log('Testing Datto RMM connection...');
const rmmClient = getDattoRMMClient();
// Try to get sites as a test
const sites = await rmmClient.getSites();
return NextResponse.json({
success: true,
message: 'Successfully connected to Datto RMM',
sitesCount: sites.length,
sites: sites.slice(0, 5).map(s => ({
id: s.id,
name: s.name,
description: s.description
}))
});
} catch (error) {
console.error('RMM test failed:', error);
return NextResponse.json({
success: false,
error: error instanceof Error ? error.message : 'Unknown error',
hint: 'Check console for detailed error information'
}, { status: 500 });
}
}