- API key auth via x-openclaw-key header (OPENCLAW_API_KEY env var)
- GET /api/openclaw/sync/status
- POST /api/openclaw/sync/autotask/incremental
- POST /api/openclaw/sync/autotask/full
- POST /api/openclaw/sync/autotask/entity { entities: [...] }
- POST /api/openclaw/sync/datto-rmm { syncType: full|incremental }
- POST /api/openclaw/sync/sentinelone
- POST /api/openclaw/sync/veeam { syncType: full|incremental }
- POST /api/openclaw/sync/zoom
- POST /api/openclaw/sync/engagement
- POST /api/openclaw/sync/qbo { syncType: full|incremental }
- POST /api/openclaw/sync/zabbix
- POST /api/openclaw/sync/itglue
All routes bypass Better Auth middleware, delegate to existing sync services
26 lines
892 B
TypeScript
26 lines
892 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { validateOpenClawKey } from '@/lib/utils/openclaw-auth';
|
|
import { getITGlueSyncService } from '@/lib/services/itglue-sync-service';
|
|
|
|
export async function POST(request: NextRequest) {
|
|
const authError = validateOpenClawKey(request);
|
|
if (authError) return authError;
|
|
|
|
try {
|
|
const svc = getITGlueSyncService();
|
|
|
|
if (svc.isSyncInProgress()) {
|
|
return NextResponse.json({ error: 'IT Glue sync already in progress' }, { status: 409 });
|
|
}
|
|
|
|
svc.fullSync('openclaw').catch((err) => console.error('[OpenClaw] IT Glue sync failed:', err));
|
|
|
|
return NextResponse.json({
|
|
message: 'IT Glue sync started',
|
|
triggeredBy: 'openclaw',
|
|
});
|
|
} catch (error) {
|
|
const msg = error instanceof Error ? error.message : String(error);
|
|
return NextResponse.json({ error: msg }, { status: 500 });
|
|
}
|
|
}
|