# API-Response-Beispiele

## 1. Events auflisten (GET /api/events)

### Request:
```
GET /api/events?from=2026-04-15&to=2026-05-31&location=Dresden&category=Kultur&limit=20
```

### Response (200 OK):
```json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "source_id": 1,
      "external_id": "stadt-dresden-123",
      "title": "Ostermarkt auf der Altstadt",
      "description": "Traditioneller Ostermarkt mit lokalen Kunsthandwerkern...",
      "location": "Dresden",
      "category": "Kultur",
      "slug": "ostermarkt-auf-der-altstadt-abc123",
      "image_url": "https://...",
      "website_url": "https://...",
      "contact_email": "info@ostermarkt.de",
      "contact_phone": "+49 351 ...",
      "status": "published",
      "created_at": "2026-03-15T10:30:00+02:00",
      "updated_at": "2026-04-09T14:22:00+02:00",
      "source": {
        "id": 1,
        "name": "Stadt Dresden",
        "description": "Offizielle Veranstaltungen der Stadt Dresden",
        "url": "https://stadt-dresden.de",
        "status": "active",
        "last_import_at": "2026-04-09T12:00:00+02:00"
      },
      "occurrences": [
        {
          "id": 5,
          "event_id": 1,
          "start_datetime": "2026-04-18T10:00:00+02:00",
          "end_datetime": "2026-04-20T18:00:00+02:00",
          "is_all_day": false,
          "location_details": "Altstadt, Striezelmarkt-Gelände",
          "capacity": 1000,
          "available_tickets": 950,
          "price": "0.00",
          "status": "scheduled",
          "formatted_duration": "10:00 - 18:00"
        }
      ]
    },
    {
      "id": 2,
      "source_id": 1,
      "external_id": "stadt-dresden-456",
      "title": "Theatervorstellung: Hamlet",
      "description": "Klassisches Drama von William Shakespeare...",
      "location": "Dresden",
      "category": "Kultur",
      "slug": "theatervorstellung-hamlet-def456",
      "image_url": "https://...",
      "website_url": "https://...",
      "contact_email": "info@schauplatz-dresden.de",
      "contact_phone": "+49 351 ...",
      "status": "published",
      "created_at": "2026-03-10T08:15:00+02:00",
      "updated_at": "2026-04-08T16:45:00+02:00",
      "source": {
        "id": 1,
        "name": "Stadt Dresden"
      },
      "occurrences": [
        {
          "id": 8,
          "event_id": 2,
          "start_datetime": "2026-04-25T20:00:00+02:00",
          "end_datetime": "2026-04-25T22:30:00+02:00",
          "is_all_day": false,
          "location_details": "Großes Haus",
          "capacity": 500,
          "available_tickets": 120,
          "price": "45.00",
          "status": "scheduled",
          "formatted_duration": "20:00 - 22:30"
        },
        {
          "id": 9,
          "event_id": 2,
          "start_datetime": "2026-04-26T20:00:00+02:00",
          "end_datetime": "2026-04-26T22:30:00+02:00",
          "is_all_day": false,
          "location_details": "Großes Haus",
          "capacity": 500,
          "available_tickets": 0,
          "price": "45.00",
          "status": "scheduled",
          "formatted_duration": "20:00 - 22:30"
        }
      ]
    }
  ],
  "pagination": {
    "total": 47,
    "per_page": 20,
    "current_page": 1,
    "last_page": 3
  }
}
```

---

## 2. Einzelnes Event anzeigen (GET /api/events/{id})

### Request:
```
GET /api/events/1
```

### Response (200 OK):
```json
{
  "success": true,
  "data": {
    "id": 1,
    "source_id": 1,
    "external_id": "stadt-dresden-123",
    "title": "Ostermarkt auf der Altstadt",
    "description": "Traditioneller Ostermarkt mit Kunsthandwerkern, Osterleckereien und Familie-Aktivitäten.",
    "location": "Dresden",
    "category": "Kultur",
    "slug": "ostermarkt-auf-der-altstadt-abc123",
    "image_url": "https://cdn.example.com/ostermarkt.jpg",
    "website_url": "https://ostermarkt-dresden.de",
    "contact_email": "info@ostermarkt.de",
    "contact_phone": "+49 351 123456",
    "status": "published",
    "created_at": "2026-03-15T10:30:00+02:00",
    "updated_at": "2026-04-09T14:22:00+02:00",
    "source": {
      "id": 1,
      "name": "Stadt Dresden",
      "description": "Offizielle Veranstaltungen der Stadt Dresden",
      "url": "https://stadt-dresden.de",
      "status": "active"
    },
    "occurrences": [
      {
        "id": 5,
        "event_id": 1,
        "start_datetime": "2026-04-18T10:00:00+02:00",
        "end_datetime": "2026-04-20T18:00:00+02:00",
        "is_all_day": false,
        "location_details": "Altstadt, Striezelmarkt-Gelände",
        "capacity": 1000,
        "available_tickets": 950,
        "price": "0.00",
        "status": "scheduled",
        "formatted_duration": "10:00 - 18:00"
      }
    ]
  }
}
```

---

## 3. Kategorien abrufen (GET /api/events/categories/list)

### Response (200 OK):
```json
{
  "success": true,
  "data": [
    "Bildung",
    "Bühne & Tanz",
    "Konzert",
    "Kultur",
    "Kulinarik",
    "Natur",
    "Sport",
    "Workshop"
  ]
}
```

---

## 4. Orte/Städte abrufen (GET /api/events/locations/list)

### Response (200 OK):
```json
{
  "success": true,
  "data": [
    "Bautzen",
    "Chemnitz",
    "Dresden",
    "Freiberg",
    "Görlitz",
    "Kamenz",
    "Meissen",
    "Pirna",
    "Radebeul"
  ]
}
```

---

## 5. Fehlerhafte Anfrage (400 Bad Request)

### Request:
```
GET /api/events?from=invalid-date
```

### Response (422 Unprocessable Entity):
```json
{
  "message": "The given data was invalid.",
  "errors": {
    "from": ["The from field must be a valid date."]
  }
}
```

---

## 6. Event nicht gefunden (404 Not Found)

### Request:
```
GET /api/events/99999
```

### Response (404 Not Found):
```json
{
  "success": false,
  "message": "Event nicht gefunden."
}
```
