# 이벤트 전송

## 이벤트 전송

Workflow block, REST API 또는 edge device backup을 사용하여 Vision Events를 보낼 수 있습니다.

* [Workflow Block](#workflow-block) - Workflows 사용자는 공식 Roboflow block을 사용하는 것이 가장 쉬울 것입니다.
* [REST API](#rest-api) - Workflows 외부에 모델을 배포하려는 사용자는 REST API를 사용할 수 있습니다.
* [Edge Device Backup](#edge-device-backup) - Roboflow Edge devices를 배포하는 사용자는 device의 로컬 event store에서 자동 backup을 구성하는 것이 가장 편리할 것입니다.

### Workflow Block

대부분의 사용자에게 권장되는 방법입니다. 다음을 추가하세요. **Vision Event** block을 Roboflow Workflow에 추가하면 코드 없이 inference 결과로부터 이벤트를 자동으로 생성할 수 있습니다.

#### 설정

{% stepper %}
{% step %}
**Workflow Editor를 열기**

이동하세요 **Workflows** 를 workspace에서 열고 이벤트를 추가하려는 workflow를 여세요.
{% endstep %}

{% step %}
**Vision Event Block 추가**

block catalog에서 "Vision Event"를 검색하여 workflow에 추가하세요.
{% endstep %}

{% step %}
**입력 연결**

이미지 input과 model prediction output을 Vision Event block에 연결하세요.
{% endstep %}

{% step %}
**Use Case 구성**

Use Case 이름을 설정하세요 (`useCaseId`). 또한 상위 block에서 custom metadata를 매핑할 수 있습니다.
{% endstep %}

{% step %}
**Workflow 배포**

workflow를 배포하거나 업데이트하세요. workflow가 실행될 때마다 이벤트가 자동으로 생성됩니다.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Workflow block은 이미지 업로드와 이벤트 생성을 단일 단계로 처리합니다.
{% endhint %}

### REST API

Workflows를 사용하지 않는 custom integrations 또는 pipeline의 경우, REST API를 통해 직접 이벤트를 보낼 수 있습니다. 전체 요청 및 응답 schema는 다음을 참조하세요. [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events).

#### 인증

모든 write endpoint에는 다음 scope가 포함된 API key가 필요합니다. `visionEvents.write` 또는 `device.update` scope. API key를 Bearer token으로 전달하세요:

```
Authorization: Bearer YOUR_API_KEY
```

#### End-to-End 예시: 이미지 업로드 + 이벤트 생성

{% hint style="warning" %}
이벤트를 보내기 전에 Use Case를 생성해야 합니다.  `useCaseId` 존재하지 않는 항목을 참조하는 이벤트는 거부됩니다.
{% endhint %}

API를 통해 이벤트를 보낼 때는 먼저 이미지를 업로드한 다음, 업로드한 이미지를 참조하는 이벤트를 생성합니다.

**1단계: 이미지 업로드**

```bash
curl -X POST "https://api.roboflow.com/vision-events/upload" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@inspection_photo.jpg"
```

**응답:**

```json
{
  "success": true,
  "sourceId": "abc123def456",
  "url": "https://storage.googleapis.com/your-workspace/abc123def456/original.jpg"
}
```

**2단계: 업로드된 이미지를 참조하여 이벤트 생성**

```bash
curl -X POST "https://api.roboflow.com/vision-events" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "eventType": "quality_check",
    "useCaseId": "assembly-line-qa",
    "timestamp": "2026-03-30T14:30:00.000Z",
    "deviceId": "factory-cam-01",
    "streamId": "line-3",
    "images": [
      {
        "sourceId": "abc123def456",
        "objectDetections": [
          {
            "class": "defect",
            "x": 320,
            "y": 240,
            "width": 50,
            "height": 40,
            "confidence": 0.95
          }
        ]
      }
    ],
    "eventData": {
      "result": "fail"
    },
    "customMetadata": {
      "line_id": "line-3",
      "shift": "morning",
      "part_number": "PN-4421"
    }
  }'
```

**응답:**

```json
{
  "eventId": "evt-789ghi",
  "created": true
}
```

#### 일괄 이벤트 생성

batch endpoint를 사용하여 한 번의 요청으로 최대 100개의 이벤트를 보낼 수 있습니다:

```bash
curl -X POST "https://api.roboflow.com/vision-events/batch" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "events": [
      {
        "eventType": "quality_check",
        "useCaseId": "alksjdflaalsf32",
        "eventData": { "result": "pass" },
        "customMetadata": { "line_id": "line-1" }
      },
      {
        "eventType": "quality_check",
        "useCaseId": "alksjdflaalsf32",
        "eventData": { "result": "fail" },
        "customMetadata": { "line_id": "line-2" }
      }
    ]
  }'
```

{% hint style="info" %}
batch 요청당 최대 100개 이벤트.
{% endhint %}

### Edge Device Backup

연결이 간헐적일 수 있는 enterprise deployment의 경우, edge device가 이벤트를 로컬에 저장하고 연결이 복구되면 Roboflow와 동기화합니다.

{% hint style="info" %}
Edge Device Backup에는 Deployment Manager가 필요합니다. 다음을 참조하세요. [Deployment Manager documentation](/roboflow/roboflow-ko/deploy/device-manager.md) 설정 지침은 여기에서 확인하세요.
{% endhint %}

Vision Events backup을 사용하려면:

1. 워크스페이스에서 열고 **Deployment Manager** 를 workspace에서
2. 구성할 device를 선택하세요
3. 활성화 **Vision Events Backup** 를 device의 Event Store 구성에서
4. 이벤트는 device의 로컬 event store에 기록됩니다
5. device가 다시 연결되면 이벤트가 자동으로 Roboflow에 동기화됩니다

동기화가 완료되면 이벤트가 Vision Events dashboard에 표시됩니다.

<figure><img src="/files/3b21c38bf4cc6f087d3a86d9c48ad0b6ec560b60" alt="" width="375"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-ko/deploy/vision-events/send-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
