Read the first chapter
The whole of chapter one, free. About 3 min. Turn the pages with the arrows, your keyboard, or a swipe.
Chapter 1
Authentication & API Keys
क्या आपका भीड़-मीटर प्लगइन हर अनुरोध में सही प्रमाणीकरण हेडर के साथ चल रहा है-या कुछ अनुरोध “बिना कुंजी” के पास हो रहे हैं? यह अनुभाग API Keys सेटअप, सुरक्षित स्टोरेज, और प्रत्येक अनुरोध में प्रमाणीकरण जोड़ने के लिए एक सुसंगत KEYS-First Handshake देता है; जब भी आप API कॉल इंटीग्रेट कर रहे हों, यह उपयोगी है।
कुंजी-केंद्रित हैंडशेक (KEYS-First Handshake) भीड़-मीटर प्लगइन में अनुरोध भेजने से पहले ये क्रम रखें: (1) API Key को सुरक्षित रूप से लोड करें, (2) उसे हेडर में लगाएं, (3) सर्वर से प्रतिक्रिया कोड/त्रुटि के आधार पर पुनः प्रयास/लॉगिंग करें। यह पैटर्न तब लागू होता है जब आप cURL, Node.js, या Python से /v1/... एंडपॉइंट्स कॉल करते हैं।
प्रमुख एंडपॉइंट्स और हेडर संकेत - प्रमाणीकरण हेडर: Authorization: Bearer - सामान्य API कॉल पैटर्न: - POST /v1/density/estimate (इमेज/फ्रेम से भीड़ घनत्व अनुमान) - GET /v1/health (कनेक्टिविटी/कुंजी सत्यापन के लिए हल्का चेक)
| प्रयोजन | विधि | पाथ | अपेक्षित प्रमाणीकरण | |---|---|---|---| | स्वास्थ्य/कुंजी वैधता | GET | /v1/health | Bearer टोकन | | घनत्व अनुमान | POST | /v1/density/estimate | Bearer टोकन |
API Keys और अनुरोध विकल्प | Parameter | Type | Required | Description | |---|---|---:|---| | API_KEY | string | हाँ | प्लगइन का गुप्त API Key; इसे कभी भी सोर्स कोड/लॉग में हार्डकोड न करें | | Authorization | string | हाँ | Bearer फॉर्मेट में हेडर | | request_id | string | नहीं | ट्रेसिंग के लिए; 16-64 अक्षर, UUID v4 अनुशंसित | | timeout_ms | integer | नहीं | क्लाइंट टाइमआउट (उदा. 10000) | | retry_on | array[string] | नहीं | किन स्टेटस पर रीट्राई: उदाहरण [429, 500, 502, 503, 504] | | max_retries | integer | नहीं | रीट्राई की अधिकतम संख्या (उदा. 3) |
सुरक्षित स्टोरेज (अनिवार्य): - Linux/macOS: export CROWD_METER_API_KEY="..." - Windows (PowerShell): $env:CROWD_METER_API_KEY="..." - रनटाइम में केवल वातावरण चर (environment variables) से पढ़ें;.env फाइलें केवल डेवलपमेंट में और.env को वर्जन कंट्रोल से बाहर रखें।
प्रमाणीकरण हेडर सहित कार्यशील इंटीग्रेशन उदाहरण
cURL `bash
वातावरण चर से API Key पढ़ें export CROWD_METER_API_KEY="आपकी_गुप्त_कुंजी"
फ्रेम/इमेज के साथ घनत्व अनुमान अनुरोध curl -sS \ -X POST "https://api.crowd-meter.example.com/v1/density/estimate" \ -H "Authorization: Bearer ${CROWD_METER_API_KEY}" \ -H "Content-Type: application/json" \ -H "request_id: 550e8400-e29b-41d4-a716-446655440000" \ -d '{ "camera_id": "cam-12", "timestamp": "2026-04-28T10:15:30Z", "frame_ref": { "type": "url", "value": "https://storage.example.com/frames/frame_20260428T101530Z.jpg" } }' `
Node.js `js import fetch from "node-fetch";
const API_KEY = process.env.CROWD_METER_API_KEY; // केवल environment से const requestId = "550e8400-e29b-41d4-a716-446655440000";
const res = await fetch("https://api.crowd-meter.example.com/v1/density/estimate", { method: "POST", headers: { "Authorization": Bearer ${API_KEY}, "Content-Type": "application/json", "request_id": requestId }, body: JSON.stringify({ camera_id: "cam-12", timestamp: "2026-04-28T10:15:30Z", frame_ref: { type: "url", value: "https://storage.example.com/frames/frame_20260428T101530Z.jpg" } }) });
const payload = await res.json(); console.log(payload); `
Python `python import os, requests
API_KEY = os.environ["CROWD_METER_API_KEY"] headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", "request_id": "550e8400-e29b-41d4-a716-446655440000" }
payload = { "camera_id": "cam-12", "timestamp": "2026-04-28T10:15:30Z", "frame_ref": {"type": "url", "value": "https://storage.example.com/frames/frame_20260428T101530Z.jpg"} }
r = requests.post("https://api.crowd-meter.example.com/v1/density/estimate", headers=headers, json=payload, timeout=10) print(r.status_code, r.json()) `
अपेक्षित प्रतिक्रिया संरचना (JSON) `json {
{ "request_id": "550e8400-e29b-41d4-a716-446655440000", "camera_id": "cam-12", "timestamp": "2026-04-28T10:15:30Z", "density": { "value": 87.4, "unit": "persons_per_m2" }, "confidence": 0.81, "model_version": "crowd-meter-v3.2.1", "debug": { "roi_pixels": 64000, "detected_people": 523 } } `
| फ़ील्ड | Type | विवरण | |---|---|---| | request_id | string | वही आईडी जो आपने भेजी; ट्रेसिंग के लिए | | camera_id | string | कैमरा पहचानकर्ता | | timestamp | string | फ्रेम का ISO-8601 समय | | density.value | number | अनुमानित भीड़ घनत्व | | density.unit | string | persons_per_m2 (स्थिर) | | confidence | number | 0.0-1.0; मॉडल की विश्वसनीयता | | model_version | string | उपयोग हुआ मॉडल/वर्ज़न | | debug.detected_people | integer | आंतरिक डिटेक्शन काउंट (यदि सक्षम हो) |
प्रमाणीकरण/कुंजी उपयोग में ध्यान देने योग्य बिंदु - कुंजी लीक रोकें: API Key को क्लाइंट-साइड (ब्राउज़र/मोबाइल) कोड में न भेजें। सर्वर-साइड पर Authorization: Bearer... लगाएं। - टाइमआउट और रीट्राई: इमेज/फ्रेम प्रोसेसिंग में विलंब हो सकता है; timeout_ms ~ 10000-30000 रखें और रीट्राई सिर्फ [429, 500, 502, 503, 504] जैसी ट्रांज़िएंट त्रुटियों पर करें। - एरर स्ट्रक्चर हैंडलिंग: 401/403 पर रीट्राई न करें; यह कुंजी/अधिकार समस्या है। 400 पर payload वैलिडेशन (जैसे timestamp ISO-8601) ठीक करें। - हेडर की केस/फॉर्मेटिंग: Authorization का फॉर्मेट Bearer ही रखें; Bearer के बाद अतिरिक्त स्पेस या newline न आएं।
अगला भाग API Key रोटेशन और मल्टी-एन्वायरनमेंट (डेवलपमेंट/स्टेजिंग/प्रोडक्शन) डिप्लॉयमेंट को बिना सेवा बाधित किए कैसे करें, उस पर फोकस करेगा
End of chapter one. 4 more chapters in the full book.
Swipe or use the arrows to turn the page
What's inside: 5 chapters
- 1. Authentication & API Keys
- 2. Create Camera Session Endpoint
- 3. Submit Frame for Density Inference
- 4. Get Density Results by Session
- 5. Error Codes & Webhook Retries
About this book
"AI भीड़-मीटर" is a technical book by Anonymous with 5 chapters and approximately 3,062 words. AI plugin for estimating crowd density from street cameras.
This book was created using Inkfluence AI, an AI-powered book generation platform that helps authors write, design, and publish complete books. It was made with the AI Documentation Generator.
Frequently Asked Questions
What is "AI भीड़-मीटर" about?
AI plugin for estimating crowd density from street cameras
How many chapters are in "AI भीड़-मीटर"?
The book contains 5 chapters and approximately 3,062 words. Topics covered include Authentication & API Keys, Create Camera Session Endpoint, Submit Frame for Density Inference, Get Density Results by Session, and more.
Who wrote "AI भीड़-मीटर"?
This book was written by Anonymous and created using Inkfluence AI, an AI book generation platform that helps authors write, design, and publish books.
How can I create a similar technical book?
You can create your own technical book using Inkfluence AI. Describe your idea, choose your style, and the AI writes the full book for you. It's free to start.
Write your own technical book with AI
Describe your idea and Inkfluence writes the whole thing. Free to start.
Start writingCreated with Inkfluence AI