# Events भेजें

## Events भेजें

आप Workflow block, REST API, या edge device backup का उपयोग करके Vision Events भेज सकते हैं।

* [Workflow Block](#workflow-block) - Workflows के उपयोगकर्ताओं को संभवतः आधिकारिक Roboflow block का उपयोग करना सबसे आसान लगेगा
* [REST API](#rest-api) - जो उपयोगकर्ता Workflows के बाहर models deploy करना चुनते हैं, वे हमारे REST API का उपयोग कर सकते हैं
* [Edge Device Backup](#edge-device-backup) - Roboflow Edge devices deploy करने वाले उपयोगकर्ताओं को डिवाइस पर local event store से automated backup configure करना सबसे सुविधाजनक लगेगा

### Workflow Block

अधिकांश उपयोगकर्ताओं के लिए सुझाया गया तरीका। जोड़ें **Vision Event** block को किसी भी Roboflow Workflow में, ताकि बिना code के inference results से automatically events बनाए जा सकें।

#### सेटअप

{% stepper %}
{% step %}
**Workflow Editor खोलें**

पर जाएं **Workflows** अपने workspace में और उस workflow को खोलें जिसमें आप events जोड़ना चाहते हैं।
{% endstep %}

{% step %}
**Vision Event Block जोड़ें**

block catalog में "Vision Event" खोजें और इसे अपने workflow में जोड़ें।
{% endstep %}

{% step %}
**Inputs कनेक्ट करें**

image input और model prediction outputs को Vision Event block से कनेक्ट करें।
{% endstep %}

{% step %}
**Use Case कॉन्फ़िगर करें**

Use Case का नाम सेट करें (`useCaseId`)। आप upstream blocks से custom metadata भी map कर सकते हैं।
{% endstep %}

{% step %}
**Workflow Deploy करें**

अपने workflow को deploy या update करें। हर बार workflow चलने पर events automatically बन जाते हैं।
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Workflow block image upload और event creation को एक ही step में संभालता है।
{% endhint %}

### REST API

Workflows का उपयोग न करने वाले custom integrations या pipelines के लिए, आप सीधे REST API के माध्यम से events भेज सकते हैं। complete request और response schemas के लिए, देखें [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events).

#### Authentication

सभी write endpoints के लिए एक API key आवश्यक है, जिसमें `visionEvents.write` या `device.update` scope शामिल हो। API key को Bearer token के रूप में pass करें:

```
Authorization: Bearer YOUR_API_KEY
```

#### End-to-End Example: Image Upload + Event Create करें

{% hint style="warning" %}
Events भेजने से पहले आपको एक Use Case बनाना होगा। किसी ऐसे `useCaseId` का संदर्भ देने वाले events जो मौजूद नहीं है, अस्वीकार कर दिए जाएंगे।
{% endhint %}

API के माध्यम से events भेजते समय, पहले आप image upload करते हैं, फिर uploaded image का संदर्भ देते हुए event बनाते हैं।

**Step 1: image upload करें**

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

**Response:**

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

**Step 2: uploaded image का संदर्भ देते हुए event बनाएं**

```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"
    }
  }'
```

**Response:**

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

#### Batch Create Events

batch endpoint का उपयोग करके एक ही request में अधिकतम 100 events भेजें:

```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 request अधिकतम 100 events।
{% endhint %}

### Edge Device Backup

ऐसे enterprise deployments के लिए जहाँ connectivity बीच-बीच में बाधित हो सकती है, edge device events को local रूप से store करता है और connectivity बहाल होने पर उन्हें Roboflow के साथ sync करता है।

{% hint style="info" %}
Edge Device Backup के लिए Deployment Manager आवश्यक है। देखें [Deployment Manager documentation](/roboflow/roboflow-hi/deploy/device-manager.md) setup instructions के लिए।
{% endhint %}

Vision Events backup सक्षम करने के लिए:

1. Open करें **Deployment Manager** अपने workspace में
2. configure करने के लिए device चुनें
3. Enable करें **Vision Events Backup** device की Event Store configuration में
4. Events device पर local event store में लिखे जाते हैं
5. जब device फिर से connect होता है, तो events automatically Roboflow के साथ sync हो जाते हैं

sync पूरा होने के बाद events Vision Events dashboard में दिखाई देते हैं।

<figure><img src="/files/60a59deb174e50eec0122fccf8f048cc4e4c62b7" 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-hi/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.
