暫無描述

iris_api_examples.sh 981B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. IRIS_BASE_URL="${IRIS_BASE_URL:-https://localhost:8443}"
  4. IRIS_API_KEY="${IRIS_API_KEY:-}"
  5. INTEGRATOR_URL="${INTEGRATOR_URL:-http://localhost:8088}"
  6. echo "[1/2] Direct IRIS API call"
  7. curl -k -sS -X POST "${IRIS_BASE_URL}/api/v2/cases" \
  8. -H "Content-Type: application/json" \
  9. ${IRIS_API_KEY:+-H "Authorization: Bearer ${IRIS_API_KEY}"} \
  10. -d '{
  11. "title": "Sample SOC case from curl",
  12. "description": "Direct IRIS API example",
  13. "tags": ["soc", "sample", "curl"]
  14. }' | sed 's/^/ /'
  15. echo
  16. echo "[2/2] Call IRIS through SOC Integrator"
  17. curl -sS -X POST "${INTEGRATOR_URL}/action/create-iris-case" \
  18. -H "Content-Type: application/json" \
  19. -d '{
  20. "title": "Sample SOC case via integrator (curl)",
  21. "severity": "medium",
  22. "source": "soc-integrator-curl-sample",
  23. "payload": {
  24. "description": "Case created through integrator endpoint",
  25. "tags": ["soc", "integrator", "curl"]
  26. }
  27. }' | sed 's/^/ /'
  28. echo