Skip to content

Instantly share code, notes, and snippets.

@aimtiaz11
Created January 30, 2026 05:29
Show Gist options
  • Select an option

  • Save aimtiaz11/af9047933d820f2e052db0c02dfcd14b to your computer and use it in GitHub Desktop.

Select an option

Save aimtiaz11/af9047933d820f2e052db0c02dfcd14b to your computer and use it in GitHub Desktop.
Swagger API - List all APIs (method and path)
# You can run this script with Python 3.x
import json
import sys
with open(sys.argv[1], 'r', encoding='utf-8') as f:
data = json.load(f)
print(f"{data.get('info', {}).get('title', 'No Title')} - {data.get('info', {}).get('version', 'No Version')}")
for path, methods in data.get('paths', {}).items():
for method in methods:
if method.upper() in ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD']:
print(f" {method.upper()}: {path}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment