| title | har2http Converter | |
|---|---|---|
| description | Convert HAR files from browser developer tools to REST CLI request files. | |
| tags |
|
Convert HTTP Archive (HAR) files exported from browser developer tools into editable .http request files.
HAR files capture complete HTTP traffic including headers, bodies, and timing data. Browser developer tools export network activity as HAR files, making them useful for debugging and API exploration.
- Open DevTools (F12)
- Navigate to Network tab
- Perform HTTP requests
- Right-click in request list → "Save all as HAR with content"
- Open Developer Tools (F12)
- Navigate to Network tab
- Perform HTTP requests
- Click gear icon → "Save All As HAR"
- Enable Develop menu (Preferences → Advanced → Show Develop menu)
- Develop → Show Web Inspector
- Navigate to Network tab
- Perform HTTP requests
- Right-click in request list → "Export HAR"
restcli har2http <har-file>Creates .http files in requests/ directory by default.
--output, -o <directory> Output directory (default: "requests")
--import-headers Include sensitive headers (Cookie, Authorization)
--format <type> Output format: http, json, yaml (default: "http")
--filter <pattern> Filter requests by URL pattern
restcli har2http network-log.harConverts all HTTP(S) requests, filters out sensitive headers automatically.
restcli har2http network-log.har --import-headersIncludes Authorization, Cookie, X-Auth-Token, X-API-Key headers. Bearer tokens are extracted to {{token}} variables.
restcli har2http network-log.har --filter "api.example.com"Only imports requests matching the URL pattern.
restcli har2http network-log.har -o api-requestsrestcli har2http network-log.har --format json
restcli har2http network-log.har --format yamlJSON and YAML formats create structured request files compatible with restcli's native format. Variable extraction is only available in HTTP format.
File naming pattern: <method>-<path>.http
Path is converted to filename by:
- Replacing
/with- - Converting to lowercase
- Removing invalid characters
Examples:
/posts/1→get-posts-1.http/api/users→get-api-users.http/comments/5/replies→get-comments-5-replies.http
### POST /api/users
# Variables:
# token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
POST https://api.example.com/api/users
Content-Type: application/json
Authorization: Bearer {{token}}
{"name":"John Doe","email":"john@example.com"}Bearer tokens are automatically detected and templated:
Original:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
Converted:
Authorization: Bearer {{token}}
Token value is documented in file comments.
By default, sensitive headers are excluded:
- Cookie
- Authorization
- X-Auth-Token
- X-API-Key
Use --import-headers to include them as variables.
Use browser to interact with API, export HAR file.
restcli har2http captures/session.har -o api-requests --import-headersMove generated files to appropriate collections:
collections/
auth/
post-login.http
users/
get-users.http
post-users.http
Edit imported requests:
- Replace hardcoded values with variables
- Add environment-specific configurations
- Remove unnecessary headers
- Add documentation comments
restcli exec api-requests/post-users.httpFilter by domain to reduce output:
restcli har2http large-capture.har --filter "myapi.com"Use descriptive output directories:
restcli har2http session1.har -o requests/session1
restcli har2http session2.har -o requests/session2Some extensions export HAR files automatically:
- Chrome: HTTP Archive Viewer
- Firefox: HAR Export Trigger
Always review imported requests before committing to repository. Remove sensitive data, test tokens, or personal information.
Only HTTP(S) requests are converted. WebSocket, data URLs, and other protocols are ignored.
Some browsers don't include request bodies in HAR exports. Use "Save all as HAR with content" option.
Multiple requests to same endpoint will overwrite each other unless the URLs differ (e.g., query parameters or IDs in path). If you need to preserve all requests, export separate HAR files or use the --filter flag to process them separately.
- curl2http - Import from curl commands
- openapi2http - Import from OpenAPI specs
- Collections - Organize requests
- Variables - Template configuration