API Tester Skill
This skill helps test and validate REST API endpoints with comprehensive request/response analysis.
Capabilities
- Send HTTP requests (GET, POST, PUT, DELETE, PATCH)
- Validate response status codes
- Check response headers and content types
- Parse and validate JSON responses
- Test authentication (Bearer tokens, API keys, Basic auth)
- Measure response times
- Generate test reports
When to Use
Use this skill when the user asks to:
- Test an API endpoint
- Validate API responses
- Check API authentication
- Debug API issues
- Generate API test reports
- Measure API performance
Example Usage
import requests
import json
# Test GET request
response = requests.get(
'https://api.example.com/users',
headers={'Authorization': 'Bearer token123'}
)
# Validate response
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/json'
data = response.json()
assert 'users' in data
assert len(data['users']) > 0
# Test POST request
payload = {'name': 'John', 'email': 'john@example.com'}
response = requests.post(
'https://api.example.com/users',
json=payload,
headers={'Content-Type': 'application/json'}
)
assert response.status_code == 201
Dependencies
- requests>=2.31.0
- pytest>=7.4.0 (for test assertions)