Tutorials and Examples in Developer Portals
Tutorials and examples show developers how to accomplish real tasks with your API. Learn how to write task-oriented tutorials, provide use-case examples, and create sample applications that accelerate integration.
What You'll Learn
You will learn how to write effective tutorials for developer portals, how to structure use-case examples, and how to create sample applications that developers can run.
Why It Matters
API reference docs tell developers what each endpoint does. Tutorials show them how to combine endpoints to accomplish real tasks. This bridges the gap between reference and real-world use.
Real-World Use
The Durga Antivirus Pro developer portal includes tutorials for common use cases: real-time threat monitoring, automated sample submission, threat intelligence feed integration, and custom alerting.
flowchart LR A[Tutorials] --> B[Real-Time Monitoring] A --> C[Automated Submission] A --> D[Threat Feed Integration] A --> E[Custom Alerting] B --> F[Webhook Integration] B --> G[Stream Processing] C --> H[File Upload] C --> I[Bulk Submit] A:::current classDef current fill:#f90,color:#fff,stroke:#333,stroke-width:2px
Tutorial Structure
# Tutorial: Real-Time Threat Monitoring with Webhooks
## What You'll Build
A real-time threat monitoring system that receives instant
notifications when new threats are detected.
## Prerequisites
- A Durga Antivirus Pro API key (get one in the quickstart)
- A publicly accessible webhook endpoint
- Python 3.8 or later
## Step 1: Create a Webhook Endpoint
```python
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/<a href="/backend/webhooks/">Webhook</a>/threat", methods=["POST"])
def handle_threat():
data = request.json
print(f"Threat detected: {data['name']} "
f"(severity: {data['severity']})")
return jsonify({"status": "received"}), 200
if __name__ == "__main__":
app.run(port=8080)
Step 2: Register the Webhook
curl -X POST "https://api.durgaantivirus.com/v1/<a href="/backend/webhooks/">Webhooks</a>" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook/threat",
"events": ["threat.detected", "threat.resolved"],
"secret": "your_webhook_secret"
}'
Step 3: Test the Integration
Run your Flask app and trigger a test event:
python webhook_server.py
# Server running on http://localhost:8080
Expected Behavior
When a new threat is detected, your webhook endpoint receives a POST request with this payload:
{
"event": "threat.detected",
"threat_id": "thr_abc123",
"name": "Trojan.Generic.12345",
"severity": "critical",
"detected_at": "2026-06-28T10:30:00Z"
}
Complete Solution
The full sample application is available on GitHub: github.com/durga/webhook-monitor
## Sample Application Repository
```bash
# Sample app structure
sample-apps/
threat-monitor/
README.md
requirements.txt
webhook_server.py
config.py.example
threat-analyzer/
README.md
analyze.py
requirements.txt
Use-Case Examples
Organize tutorials by use case:
use_cases:
- name: "Threat Monitoring"
tutorials:
- "Real-time webhook monitoring"
- "Building a threat dashboard"
- "Email alert integration"
- name: "Threat Analysis"
tutorials:
- "Automated sample submission"
- "Batch threat analysis"
- "Threat intelligence feed"
- name: "Compliance"
tutorials:
- "Audit log integration"
- "Automated reporting"
Common Mistakes
1. Tutorials That Are Too Long
Tutorials over 10 steps or 15 minutes lose developer attention. Keep each tutorial focused on one task.
2. No Working Sample Code
Tutorials without runnable sample code force developers to type everything manually. Provide GitHub repositories with complete solutions.
3. Assuming Prerequisites Are Met
Clearly list all prerequisites before the tutorial starts. Nothing frustrates a developer more than discovering they need an account halfway through.
4. No Verification Step
Every tutorial should end with a way to verify it worked. Expected output, screenshots, or test scripts confirm success.
5. Tutorials That Go Out of Date
Tutorials with hardcoded API versions or deprecated features age quickly. Test tutorials on every API release.
Practice Questions
1. How does a tutorial differ from API reference documentation?
Tutorials combine multiple endpoints to accomplish real tasks. Reference docs describe individual endpoints.
2. What are the essential sections of a tutorial?
What you will build, prerequisites, step-by-step instructions with code, verification step, and complete solution link.
3. Why should tutorials be under 10 steps and 15 minutes?
Longer tutorials lose developer attention. Developers want to accomplish a task quickly and move on.
4. How do you ensure tutorials stay up to date?
Test tutorials on every API release. Use automated tests that verify tutorial code examples work.
5. Challenge: Write a tutorial for an API use case of your choice. Include a description of what the developer will build, prerequisites, step-by-step instructions with working code, expected output, and a link to the complete solution repository.
FAQ
Mini Project
Create a tutorial for a common use case of an API you use or create a sample API. Write the tutorial with prerequisites, step-by-step instructions, working code examples, expected output, and a complete solution repository. Test the tutorial by following it from start to finish.
What's Next
After tutorials, learn about Changelog and Release Notes to communicate API changes to developers effectively.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro