Section 2 APIs-Authentifizierung und Integrationsmuster – praktische Übung Webhook-gesteuerte Orderverarbeitung

Problem/Fehler/Frage beschreiben

✓ Gültige Bestellung gibt 200 mit korrekter Antwort zurück
✗ Fehlende Felder geben 400 mit Fehlerstatus zurück. Erwartet 400 Fehler für fehlende erforderliche Felder
✓ Fehlende Authentifizierung gibt 403 zurück

Webhook-Tester nicht bestanden, befolge Anleitung bereits 100%, aber trotzdem fehlgeschlagen.

Welche Fehlermeldung gibt es (falls vorhanden)?

Gültige Bestellung gibt 200 mit korrekter Antwort zurück

Fehlende Felder geben 400 mit Fehlerstatus zurück. Erwartet 400 Fehler für fehlende erforderliche Felder

Fehlende Authentifizierung gibt 403 zurück

Bitte teile deinen Workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "course/n8n102/new-order",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "e562e52c-483b-4084-a08b-96a9ff6bf1a9",
      "name": "WebhookNewOrder",
      "webhookId": "01db53d7-73ec-40c2-b91b-2c97da6e2535",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "a65d16fa-2ec8-48ee-898e-a0ef28462992",
              "leftValue": "={{ $json.body.order_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "3c8039b7-3a17-4387-805c-59ea5ff40377",
              "leftValue": "={{ $json.body.customer_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "19ef2054-2b99-4b20-9a17-e4f900b9d050",
              "leftValue": "={{ $json.body.total }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        208,
        0
      ],
      "id": "14611c3e-1eb2-4802-8fbc-2309d1a7074e",
      "name": "ValidateRequiredFields"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"accepted\",\n  \"order_id\": \"{{ $('WebhookNewOrder').item.json.body.order_id }}\",\n  \"message\": \"Order received and queued for processing\"\n}",
        "options": {
          "responseCode": 200
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        416,
        -96
      ],
      "id": "d1fd5364-556a-46d4-9240-fb84f22e9767",
      "name": "RespondSuccess"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"error\",\n  \"message\": \"Missing required fields: order_id, customer_id, and total are required\"\n}",
        "options": {
          "responseCode": 400
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        416,
        96
      ],
      "id": "c7dad4f2-1f70-4138-914c-144de8643f7e",
      "name": "RespondValidationError"
    }
  ],
  "connections": {
    "WebhookNewOrder": {
      "main": [
        [
          {
            "node": "ValidateRequiredFields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ValidateRequiredFields": {
      "main": [
        [
          {
            "node": "RespondSuccess",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RespondValidationError",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "bed2988fb684ee16b2cfbdee45dcd5e341307ecfd375cd84c432f4ed9cece2d3"
  }
}

Ausgabe des letzten Knotens teilen

Informationen zu deinem n8n-Setup

    1. n8n Version: 2.15.0
    2. Datenbank: SQLite (Standard)
    3. EXECUTIONS_PROCESS Einstellung: main
    4. n8n läuft über: Docker (auf Zeabur)
    5. Betriebssystem: Linux (Ubuntu 24, Zeabur gehostet)

Dies ist eine Typkonflikt-Bedingung

ich habe zu string gewechselt … kann auch nicht auflösen … bin mir nicht sicher, was das problem ist, mismatch.. .folge bereits der gegebenen anweisung

Hallo,

wir hatten einen Fehler, der behoben wurde.

Alles Gute,