FormRead सर्वर-साइड प्रोसेसिंग API

सर्वर-साइड फॉर्म प्रोसेसिंग

FormRead सर्वर-साइड API आपको एक स्कैन किए गए फॉर्म इमेज को भेजने और सीधे JSON के रूप में संरचित परिणाम (OMR, OCR, BCR) प्राप्त करने देता है। कोई ब्राउज़र नहीं, कोई iframe नहीं - बस आपके बैकएंड से हमारे बैकएंड तक एक सरल HTTP अनुरोध।

  • एक इमेज भेजें, एकल अनुरोध में JSON के रूप में परिणाम प्राप्त करें
  • OMR (बबल डिटेक्शन), OCR (टेक्स्ट एक्सट्रैक्शन), और BCR (बारकोड/QR रीडिंग) का समर्थन करता है
  • फॉर्म कॉन्फ़िगरेशन डैशबोर्ड में आपके द्वारा सेट किए गए फॉर्म से स्वचालित रूप से लोड होता है
इस API का उपयोग कब करें

सर्वर-साइड API का उपयोग तब करें जब आपको बिना किसी उपयोगकर्ता इंटरफ़ेस के स्वचालित, सर्वर-टू-सर्वर प्रोसेसिंग की आवश्यकता हो - उदाहरण के लिए, फ़ोल्डर से स्कैन किए गए फॉर्म के बैचों को प्रोसेस करना, अपने मौजूदा बैकएंड पाइपलाइन के साथ एकीकृत करना, या स्वचालित ग्रेडिंग सिस्टम बनाना।

यदि आपको एक विज़ुअल इंटरफ़ेस चाहिए जहाँ उपयोगकर्ता फॉर्म सेट कर सकें, परिणामों की समीक्षा कर सकें, और QA कर सकें - तो Iframe इंटीग्रेशन API का उपयोग करें।

प्रमाणीकरण

एंटरप्राइज़ उपयोग के लिए, API का उपयोग Bearer Auth टोकन उत्पन्न करके किया जा सकता है।

FormRead डैशबोर्ड में लॉगिन करें और API टोकन विकल्प तक पहुंचें:

FormRead dashboard menu with the API Tokens option highlighted

API टोकन बनाएं ताकि तृतीय-पक्ष सेवाएं आपकी ओर से हमारे एप्लिकेशन से प्रमाणित हो सकें:

Creating a new FormRead API token with permission checkboxes

फॉर्म इमेज प्रोसेस करें

प्रोसेस करने के लिए एक स्कैन किए गए फॉर्म इमेज को भेजें। फॉर्म को पहले से डैशबोर्ड या iframe के माध्यम से रीड एरिया (OMR, OCR, BCR) के साथ सेट किया जाना चाहिए। API इमेज को प्रोसेस करने के लिए सहेजे गए फॉर्म कॉन्फ़िगरेशन का उपयोग करता है।

POST /api/forms/{form_id}/process

Headers

Name Value
Authorization Bearer YOUR_API_TOKEN
Accept application/json
Content-Type application/json or multipart/form-data

फ़ाइल अपलोड के साथ:

curl --location 'https://formread.org/api/forms/123/process' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --form 'image=@"/path/to/scanned-form.jpg"'

इमेज URL के साथ:

curl --location 'https://formread.org/api/forms/123/process' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{"image_url": "https://example.com/scanned-form.jpg"}'

Response

{
  "success": true,
  "results": {
    "OMR-0-0": "A",
    "OMR-0-1": "C",
    "OMR-0-2": "B,D",
    "OCR-1": "John Smith",
    "BCR-2": "1234567890"
  },
  "omr_details": {
    "OMR-0": {
      "questions": [
        [
          {"left": 0.12, "top": 0.22, "width": 0.02, "height": 0.02, "blackPixelsRatio": 0.72},
          {"left": 0.15, "top": 0.22, "width": 0.02, "height": 0.02, "blackPixelsRatio": 0.15}
        ]
      ]
    }
  },
  "anchor_error": false,
  "processing_time_ms": 450
}

प्रतिक्रिया फ़ील्ड

फ़ील्ड प्रकार विवरण
success boolean प्रोसेसिंग सफलतापूर्वक पूरी हुई या नहीं
results object एरिया परिणामों के कुंजी-मूल्य जोड़े। कुंजियाँ एरिया नाम हैं (जैसे, OMR-0-0, OCR-1, BCR-2)
omr_details object OMR क्षेत्रों के लिए स्थिति और भरण अनुपात सहित विस्तृत बबल-स्तरीय डेटा
anchor_error boolean यदि फॉर्म शीट को संरेखित नहीं किया जा सका (जैसे, कोनों का पता नहीं चला) तो सत्य
processing_time_ms integer मिलीसेकंड में प्रोसेसिंग समय

इमेज इनपुट विकल्प

आप इमेज तीन तरीकों से प्रदान कर सकते हैं। बिल्कुल एक का उपयोग करें:

पैरामीटर प्रकार विवरण
image file फ़ाइल अपलोड (multipart/form-data)
image_url string इमेज का सार्वजनिक URL
image_base64 string Base64-एन्कोडेड इमेज डेटा
Note

फॉर्म कॉन्फ़िगरेशन (रीड एरिया, थ्रेशोल्ड, एंकर) स्वचालित रूप से FormRead डैशबोर्ड में आपके द्वारा सेट किए गए फॉर्म से लोड होता है। आपको अनुरोध में कोई कॉन्फ़िगरेशन भेजने की आवश्यकता नहीं है।

Batch Processing

To process multiple images of the same form in one request, pass a comma-separated list of URLs in the image_url field. Results are returned as an array in the same order.

Request

curl --location 'https://formread.org/api/forms/123/process' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{"image_url": "https://example.com/a.jpg,https://example.com/b.jpg,https://example.com/c.jpg"}'

Response

{
  "results": [
    {
      "id": "0",
      "image_url": "https://example.com/a.jpg",
      "success": true,
      "results": { "OMR-0-0": "A", "OCR-1": "John Smith" },
      "anchor_error": false,
      "processing_time_ms": 430
    },
    {
      "id": "1",
      "image_url": "https://example.com/b.jpg",
      "success": true,
      "results": { "OMR-0-0": "B", "OCR-1": "Jane Doe" }
    },
    {
      "id": "2",
      "image_url": "https://example.com/c.jpg",
      "success": false,
      "error": "Failed to fetch image from URL: 404"
    }
  ],
  "total": 3
}

Batch Parameters

Parameter Type Default Description
image_url string One or more public image URLs. Comma-separated for batch mode.
details boolean false Include omr_details (per-bubble positions and fill ratios) in each batch result. Omitted by default to keep responses small.
Batch behavior
  • Batch mode is only available with image_url. File uploads and image_base64 are single-image only.
  • A failed URL does not fail the whole batch — that item gets "success": false and an error field; the rest continue.
  • Results preserve the submitted order via id (0-indexed).
  • omr_details is always returned in single-image mode; in batch mode it requires "details": true.

Batch with omr_details

curl --location 'https://formread.org/api/forms/123/process' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "image_url": "https://example.com/a.jpg,https://example.com/b.jpg",
    "details": true
  }'

Limits

Limit Value Behavior
Requests per minute 60 Per API token. Exceeding returns HTTP 429.
Per-request timeout 60s Requests exceeding 60 seconds are terminated with an error.

A 429 response looks like this:

{
  "message": "Too Many Attempts."
}

A batched request counts as one call regardless of how many URLs it contains.

Sizing batches
  • Per batch: measure processing_time_ms on a sample single-image response, then pack a batch that comfortably finishes under 60 seconds.
  • Across batches: pace requests so you stay under 60 per minute.
  • Image size: downsize client-side to the smallest dimensions that still yield correct results. This is the biggest lever on per-image time.

समर्थित एरिया प्रकार

प्रकार विवरण परिणाम प्रारूप
OMR ऑप्टिकल मार्क रिकॉग्निशन - उत्तर पत्रिकाओं पर भरे गए बुलबुले का पता लगाता है "A", "B,C"
OCR ऑप्टिकल कैरेक्टर रिकॉग्निशन - मुद्रित या हस्तलिखित टेक्स्ट निकालता है "John Smith"
BCR बारकोड/QR कोड रिकॉग्निशन - बारकोड और QR कोड पढ़ता है "1234567890"

कोड उदाहरण

फॉर्म इमेज प्रोसेस करने के लिए Python और JavaScript में पूर्ण उदाहरण यहाँ दिए गए हैं:

Python

import requests

API_URL = "https://formread.org/api/forms/{form_id}/process"
TOKEN = "YOUR_API_TOKEN"

with open("scanned-form.jpg", "rb") as f:
    response = requests.post(
        API_URL.format(form_id=123),
        headers={
            "Accept": "application/json",
            "Authorization": f"Bearer {TOKEN}",
        },
        files={"image": f},
    )

data = response.json()
print(data["results"])
# {"OMR-0-0": "A", "OMR-0-1": "C", "OCR-1": "John Smith"}

Node.js

const FormData = require('form-data');
const fs = require('fs');
const axios = require('axios');

const form = new FormData();
form.append('image', fs.createReadStream('scanned-form.jpg'));

const response = await axios.post(
  'https://formread.org/api/forms/123/process',
  form,
  {
    headers: {
      ...form.getHeaders(),
      'Accept': 'application/json',
      'Authorization': 'Bearer YOUR_API_TOKEN',
    },
  }
);

console.log(response.data.results);
// { 'OMR-0-0': 'A', 'OMR-0-1': 'C', 'OCR-1': 'John Smith' }

अक्सर पूछे जाने वाले प्रश्न

सर्वर-साइड प्रोसेसिंग API क्या करता है?

आप एक एकल HTTP POST में एक स्कैन किए गए फॉर्म इमेज को भेजते हैं और JSON के रूप में संरचित OMR (बबल), OCR (टेक्स्ट), और BCR (बारकोड/QR) परिणाम प्राप्त करते हैं - कोई ब्राउज़र, कोई iframe आवश्यक नहीं।

मैं अनुरोधों को कैसे प्रमाणित करूं?

अपने व्यक्तिगत एक्सेस टोकन को Authorization हेडर में Bearer टोकन के रूप में पास करें: Authorization: Bearer YOUR_API_TOKEN। टोकन को अपने FormRead डैशबोर्ड के API टोकन अनुभाग से उत्पन्न करें।

क्या मैं एक ही अनुरोध में कई इमेज प्रोसेस कर सकता हूँ?

हाँ। image_url फ़ील्ड में सार्वजनिक इमेज URL की अल्पविराम-पृथक सूची पास करें। परिणाम सबमिशन क्रम से मेल खाते हुए एक सरणी में वापस आते हैं, और एक विफल URL केवल अपनी वस्तु को विफल करता है - बाकी जारी रहते हैं।

दर और आकार की सीमाएँ क्या हैं?

प्रति API टोकन प्रति मिनट 60 अनुरोध तक, प्रति अनुरोध 60 सेकंड की प्रोसेसिंग टाइमआउट के साथ। एक बैच अनुरोध में चाहे कितने भी URL हों, इसे एक ही कॉल माना जाता है।

क्या मुझे प्रत्येक अनुरोध के साथ फॉर्म कॉन्फ़िगरेशन भेजने की आवश्यकता है?

नहीं। फॉर्म कॉन्फ़िगरेशन - रीड एरिया, थ्रेशोल्ड, एंकर - स्वचालित रूप से FormRead डैशबोर्ड में आपके द्वारा सेट किए गए फॉर्म से लोड होता है। आपके अनुरोध में केवल इमेज और URL पथ में फॉर्म आईडी की आवश्यकता होती है।

हाथ से फॉर्म ग्रेड करना बंद करें।

FormRead को अभी काम पर लगाएं: अपना फॉर्म बनाएं, अपनी पहली शीट स्कैन करें, और मिनटों में संरचित परिणाम प्राप्त करें।

अभी शुरू करें — किसी क्रेडिट कार्ड की आवश्यकता नहीं