@extends('layouts.app') @section('title', 'API 文件') @push('styles') @endpush @section('content')
{{-- ─── 側欄 ─────────────────────────────────────────────── --}} {{-- ─── 主內容 ─────────────────────────────────────────────── --}}
{{-- 認證說明 panel --}}

認證說明

如何取得並使用 API Token

Personal Token

個人 API Token,在 個人資料 → API Token 頁面產生。

透過 ?token=YOUR_TOKEN query string 或 Authorization: Bearer YOUR_TOKEN header 傳入,可設定 IP 白名單限制來源。

Base URL
{{ $baseUrl }}
{{-- 各分組 panels --}} @foreach($groups as $group)

{{ $group['title'] }}

{{ $group['desc'] }}

@foreach($group['apis'] as $api) @php $colorMap = ['GET'=>'#16a34a','POST'=>'#2563eb','PUT'=>'#d97706','DELETE'=>'#dc2626']; $iconColor = $colorMap[$api['method']] ?? '#6b7280'; $iconMap = ['GET'=>'bi-search','POST'=>'bi-plus-lg','PUT'=>'bi-pencil','DELETE'=>'bi-trash']; $apiIcon = $api['icon'] ?? ($iconMap[$api['method']] ?? 'bi-gear'); @endphp

{{ $api['desc'] }}

@if(!empty($api['notes']))
@foreach($api['notes'] as $note)

{{ $note }}

@endforeach
@endif {{-- 參數表 --}} @if(!empty($api['params']))
參數
@foreach($api['params'] as $p) @endforeach
名稱 位置 必填 型別 說明
{{ $p['name'] }} {{ $p['in'] }} @if($p['required']) 必填 @else 選填 @endif {{ $p['type'] ?? '' }} {{ $p['desc'] }}
@endif {{-- 程式碼範例 + Response --}} @if(!empty($api['examples'])) @php $langs = ['curl' => 'cURL', 'php' => 'PHP', 'python' => 'Python']; $eid = $group['id'].'-'.($loop->index); @endphp
Request 範例
@foreach($langs as $key => $label) @if(isset($api['examples'][$key])) @endif @endforeach
@foreach($langs as $key => $label) @if(isset($api['examples'][$key]))
{{ $api['examples'][$key] }}
@endif @endforeach
@endif @if(!empty($api['example_response']))
Response 範例
{{ $api['example_response'] }}
@endif @if(!empty($api['response_fields']))
回傳欄位說明
@foreach($api['response_fields'] as $f) @endforeach
欄位 型別 說明
{{ $f['name'] }} {{ $f['type'] }} {{ $f['desc'] }}
@endif {{-- 測試案例 toggle --}}
使用系統測試帳號執行真實請求
{{-- /sc-body --}} {{-- ── 測試面板 ─────────────────────────────────────────── --}} {{-- /test-panel --}}
{{-- /sc --}} @endforeach
{{-- /section-panel --}} @endforeach
@push('scripts') @endpush @endsection