Skip to content

MartinJSa/Meraki-API-Call-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

# Cisco Meraki Organization API Requests Downloader

## Project Overview

This Python script allows you to **download all API requests made to a Cisco Meraki organization's dashboard** within a specified period (using seconds for convenience), handling pagination automatically. The results are output as a CSV file for easy analysis or record-keeping.

- **Purpose:** Efficiently retrieve and archive Cisco Meraki Dashboard API requests for your organization over any user-specified period—useful for audits, troubleshooting, compliance, or analytics.

- **Features:** 
  - Handles all Meraki API pagination (fetches >1000 records if present)
  - User input for API Key, Org ID, and any timespan (in seconds)
  - Outputs a complete CSV log of API request data

---

## Dependencies

### Python Version

- **Python 3.7+** (Recommended)

### Required Python Libraries

- `requests` (HTTP API requests)
- `csv` (Standard library; for CSV output)

#### Installation Example

pip install requests

---

## Usage

### 1. Input Required

When run, the script *interactively* prompts the user for:
- **Cisco Meraki API Key**: Obtain from your Meraki Dashboard account
- **Organization ID**: Also available in the Meraki Dashboard or via the organizations API
- **Timespan (in seconds)**: For example, `86400` for the last 24 hours, `3600` for one hour

### 2. Running the Script

Save the script as `Meraki-get-api-calls.py` and run:

python Meraki-get-api-calls.py

Follow the prompts and provide the requested information.

---

## Output

- The script creates a CSV file named:

meraki_api_requests_timespan.csv

- This file contains **all Meraki Dashboard API request records** matching the given time window, with each request as a row and all available fields as columns.

---

## Example Output

id,timestamp,adminId,method,path,responseCode,responseBody...
12345,2025-07-15T14:00:05.000Z,54321,GET,/networks/1111/clients,200,...


---

## Notes

- You must have appropriate API permissions to access the chosen organization’s request logs.
- The script handles **full pagination** using the Meraki API `Link` headers; it will retrieve all records for the timespan, even when the count greatly exceeds 1,000.
- For security, do **not** share your API key/Org ID with others or commit them to version control.

---

## License

MIT License

---

## Acknowledgements

- Cisco Meraki Dashboard API Documentation
- Written by Perplexity.ai (I'm not a developer!!)
- Inspired by best practices for Python project documentation

About

Python script to download the Meraki Dashboard API calls data and save as a CSV file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages