@extends('web.layouts.web-master') @section('title', __('static.api.meta_title')) @section('meta_description', __('static.api.meta_description')) @php // Die API läuft zentral über den Publisher-Hub (pressekonto). $apiBase = rtrim((string) config('domains.domain_portal_url', config('app.url')), '/').'/api/v1'; $host = request()->getHost(); $apiBrandKey = str_contains($host, 'pressekonto') ? 'pressekonto' : (str_contains($host, 'presseecho') ? 'presseecho' : 'businessportal24'); $apiContactEmail = config('domains.domains.'.$apiBrandKey.'.brand.contact_email') ?? 'info@businessportal24.com'; $endpoints = [ [ 'group' => __('static.api.group_releases'), 'items' => [ ['method' => 'GET', 'path' => '/press-releases', 'desc' => __('static.api.ep_pr_index'), 'ability' => 'press-releases:read'], ['method' => 'POST', 'path' => '/press-releases', 'desc' => __('static.api.ep_pr_store'), 'ability' => 'press-releases:write'], ['method' => 'GET', 'path' => '/press-releases/{id}', 'desc' => __('static.api.ep_pr_show'), 'ability' => 'press-releases:read'], ['method' => 'PATCH', 'path' => '/press-releases/{id}', 'desc' => __('static.api.ep_pr_update'), 'ability' => 'press-releases:write'], ['method' => 'POST', 'path' => '/press-releases/{id}/submit', 'desc' => __('static.api.ep_pr_submit'), 'ability' => 'press-releases:write'], ['method' => 'DELETE', 'path' => '/press-releases/{id}', 'desc' => __('static.api.ep_pr_destroy'), 'ability' => 'press-releases:write'], ], ], [ 'group' => __('static.api.group_images'), 'items' => [ ['method' => 'GET', 'path' => '/press-releases/{id}/images', 'desc' => __('static.api.ep_img_index'), 'ability' => 'press-releases:read'], ['method' => 'POST', 'path' => '/press-releases/{id}/images', 'desc' => __('static.api.ep_img_store'), 'ability' => 'press-release-images:write'], ['method' => 'DELETE', 'path' => '/press-release-images/{imageId}', 'desc' => __('static.api.ep_img_destroy'), 'ability' => 'press-release-images:write'], ], ], [ 'group' => __('static.api.group_master_data'), 'items' => [ ['method' => 'GET', 'path' => '/companies', 'desc' => __('static.api.ep_companies_index'), 'ability' => 'companies:read'], ['method' => 'GET', 'path' => '/companies/{id}', 'desc' => __('static.api.ep_companies_show'), 'ability' => 'companies:read'], ['method' => 'GET', 'path' => '/categories', 'desc' => __('static.api.ep_categories_index'), 'ability' => 'press-releases:read'], ], ], ]; $pressReleaseFields = [ ['name' => 'company_id', 'type' => 'integer', 'required' => true, 'desc' => __('static.api.field_company_id')], ['name' => 'category_id', 'type' => 'integer', 'required' => true, 'desc' => __('static.api.field_category_id')], ['name' => 'language', 'type' => 'string', 'required' => true, 'desc' => __('static.api.field_language')], ['name' => 'title', 'type' => 'string', 'required' => true, 'desc' => __('static.api.field_title')], ['name' => 'text', 'type' => 'string', 'required' => true, 'desc' => __('static.api.field_text')], ['name' => 'backlink_url', 'type' => 'string', 'required' => false, 'desc' => __('static.api.field_backlink_url')], ['name' => 'keywords', 'type' => 'string', 'required' => false, 'desc' => __('static.api.field_keywords')], ['name' => 'teaser_begin / teaser_end', 'type' => 'integer', 'required' => false, 'desc' => __('static.api.field_teaser')], ['name' => 'no_export', 'type' => 'boolean', 'required' => false, 'desc' => __('static.api.field_no_export')], ]; $imageFields = [ ['name' => 'image', 'type' => 'file', 'required' => true, 'desc' => __('static.api.field_image')], ['name' => 'title', 'type' => 'string', 'required' => false, 'desc' => __('static.api.field_image_title')], ['name' => 'description', 'type' => 'string', 'required' => false, 'desc' => __('static.api.field_image_description')], ['name' => 'copyright', 'type' => 'string', 'required' => false, 'desc' => __('static.api.field_image_copyright')], ['name' => 'is_preview', 'type' => 'boolean', 'required' => false, 'desc' => __('static.api.field_image_is_preview')], ]; $statusCodes = [ ['code' => '200 / 201 / 204', 'desc' => __('static.api.status_2xx')], ['code' => '401', 'desc' => __('static.api.status_401')], ['code' => '402', 'desc' => __('static.api.status_402')], ['code' => '403', 'desc' => __('static.api.status_403')], ['code' => '409', 'desc' => __('static.api.status_409')], ['code' => '422', 'desc' => __('static.api.status_422')], ['code' => '429', 'desc' => __('static.api.status_429')], ]; $methodColors = [ 'GET' => 'text-[#1F6B3F] bg-[#E7F2EA]', 'POST' => 'text-[#8A4B12] bg-[#F7EBDD]', 'PATCH' => 'text-[#6B4FA1] bg-[#EEE9F7]', 'DELETE' => 'text-[#A13030] bg-[#F7E5E5]', ]; @endphp @section('content') {{-- Überblick + Authentifizierung --}}

{{ __('static.api.basics_heading') }}

{!! __('static.api.basics_text', ['base' => e($apiBase)]) !!}

{{ __('static.api.auth_heading') }}

{!! __('static.api.auth_text') !!}

{{-- Endpunkte --}}

{{ __('static.api.endpoints_heading') }}

@foreach ($endpoints as $group)

{{ $group['group'] }}

@foreach ($group['items'] as $endpoint)
{{ $endpoint['method'] }}
{{ $endpoint['path'] }}

{{ $endpoint['desc'] }} · {{ __('static.api.permission') }}: {{ $endpoint['ability'] }}

@endforeach
@endforeach
{{-- Felder --}}

{{ __('static.api.fields_pr_heading') }}

@foreach ($pressReleaseFields as $field) @endforeach
{{ __('static.api.th_field') }} {{ __('static.api.th_type') }} {{ __('static.api.th_required') }} {{ __('static.api.th_description') }}
{{ $field['name'] }} {{ $field['type'] }} {{ $field['required'] ? __('static.api.required_yes') : '—' }} {{ $field['desc'] }}

{{ __('static.api.fields_img_heading') }}

@foreach ($imageFields as $field) @endforeach
{{ __('static.api.th_field') }} {{ __('static.api.th_type') }} {{ __('static.api.th_required') }} {{ __('static.api.th_description') }}
{{ $field['name'] }} {{ $field['type'] }} {{ $field['required'] ? __('static.api.required_yes') : '—' }} {{ $field['desc'] }}
{{-- Workflow-Beispiel --}}

{{ __('static.api.quickstart_heading') }}

{{ __('static.api.quickstart_text') }}

{{ __('static.api.quickstart_step_1') }}
curl -X POST {{ $apiBase }}/press-releases \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "company_id": 1,
    "category_id": 2,
    "language": "de",
    "title": "Neue Produktankündigung",
    "text": "<p>Unser neues Produkt …</p>"
  }'

{{ __('static.api.quickstart_step_2') }}
curl -X POST {{ $apiBase }}/press-releases/123/images \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "image=@pressefoto.jpg" \
  -F "ai_declaration=original" \
  -F "copyright=Mustermann GmbH" \
  -F "is_preview=1"

{{ __('static.api.quickstart_step_3') }}
curl -X POST {{ $apiBase }}/press-releases/123/submit \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "ai_text_declaration": "none" }'

{{ __('static.api.ai_declaration_note') }}

{{ __('static.api.openapi_note') }} {{ __('static.api.openapi_link') }}.

{{-- Statuscodes --}}

{{ __('static.api.status_heading') }}

@foreach ($statusCodes as $status) @endforeach
{{ __('static.api.th_code') }} {{ __('static.api.th_meaning') }}
{{ $status['code'] }} {{ $status['desc'] }}
{{-- CTA --}}

{{ __('static.api.cta_heading') }}

{{ __('static.api.cta_text') }} {{ $apiContactEmail }}

@endsection