API REST des équipements réseau : automatiser sans CLI
Automatisation réseau via APIs REST sans CLI : FortiGate (FortiOS REST API), Panorama (Palo Alto), Meraki Dashboard API, Cisco DNA Center. Python + Requests pour scripts rapides et dashboards. Guide 2026.
Pourquoi REST APIs
- Structured (JSON) vs CLI parsing fragile
- Sans sessions SSH lourdes
- Idempotent + stateless
- Bindings multi-langages (Python, Go, JS)
- Natif pour SaaS cloud (Meraki, Prisma Access)
Authentification
- API Key : Meraki (X-Cisco-Meraki-API-Key header)
- OAuth 2.0 : Cisco DNA Center, Prisma Access
- Basic Auth : legacy
- Token-based : FortiOS
- Certificates : mTLS secure
FortiOS REST API
- URL : https://fortigate.example.com/api/v2/
- Endpoint exemple : GET /api/v2/cmdb/firewall/policy
- Auth : token dans header
- Rate limit : 1200 req/min par défaut
Python exemple
- import requests
- headers = {'Authorization': 'Bearer TOKEN', 'Content-Type': 'application/json'}
- resp = requests.get('https://fg.example.com/api/v2/cmdb/firewall/policy', headers=headers, verify=False)
- policies = resp.json()['results']
- for p in policies: print(p['name'], p['action'])
Meraki Dashboard API
- Simple + documented (developer.cisco.com/meraki)
- Python SDK : meraki
- Use cases : auto-create networks, push config 1000 devices
- Rate limit : 10 req/s
Cisco DNA Center API
- Token-based OAuth
- Intent API : haute niveau
- Integration API : CRUD ressources
- Webhook : events real-time
Panorama API (Palo Alto)
- XML-based (pas JSON)
- Python SDK : pan-python
- Use cases : policy push, address objects, reports
Tools
- Postman : développer/tester APIs
- Swagger/OpenAPI : documentation
- Insomnia : alternative Postman
- curl : CLI rapide
Commander chez OPTINOC
Automation réseau via REST APIs. Formation + développement scripts sur mesure. Intégration DevOps. Devis sous 48h.
