EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
route.ts
Go to the documentation of this file.
1import { NextRequest, NextResponse } from 'next/server';
2import { fieldpineServerApi } from '@/lib/server/fieldpineApi';
3import { getStoredAuth } from '@/lib/server/auth';
4
5/**
6 * OpenAPI WebGroups Endpoint
7 * GET /api/v1/openapi/webgroups - List product web groups
8 */
9export async function GET(request: NextRequest) {
10 try {
11 const authData = await getStoredAuth();
12 if (!authData || !authData.authenticated) {
13 return NextResponse.json(
14 { error: 'Authentication required' },
15 { status: 401 }
16 );
17 }
18
19 const webgroups = await fieldpineServerApi.apiCall("/ProductWebGroups", {
20 cookie: authData.apiKey,
21 useOpenApi: true
22 });
23
24 return NextResponse.json({
25 success: true,
26 data: webgroups,
27 source: 'openapi'
28 });
29
30 } catch (error) {
31 console.error('WebGroups API error:', error);
32 return NextResponse.json(
33 { error: 'Failed to fetch web groups' },
34 { status: 500 }
35 );
36 }
37}