API REST of équipements network : automatiser without CLI
Automatisation network via APIs REST without CLI : FortiGate (FortiOS REST API), Panorama (Palo Alto), Meraki Dashboard API, Cisco DNA Center. Python + Requests for scripts rapides and dashboards. Guide 2026.
Forquoi REST APIs
- Structured (JSON) vs CLI parsing fragile
- Without sessions SSH lourdes
- Idempotent + stateless
- Bindings multi-langages (Python, Go, JS)
- Natif for 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 caits : 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 caits : policy push, address objects, reports
Tools
- Postman : développer/tester APIs
- Swagger/OpenAPI : documentation
- Insomnia : alternative Postman
- curl : CLI rapide
Commander chez OPTINOC
Automation network via REST APIs. Form factorion + développement scripts sur mesure. Intégration DevOps. Devis sous 48h.
