Using HAR files or Postman collections
If you already have HAR files or Postman collections you can use them with Optic via the --har
or --postman
capture options.
ℹ️
When using the --har
or --postman
options, the typical capture flow is skipped. This means Optic doesn't start your app, the proxy, or send any traffic. If your optic.yml
includes a capture
block, it is ignored.
HAR files
Example
# unmatched (new) requests
$ optic capture openapi.yml --har ./file.har --update automatic
Learning path patterns for unmatched requests...
Documenting new operations:
✔ GET /
✔ GET /users
✔ POST /users/create
# existing requests
$ optic capture openapi.yml --har ./file.har
✔ GET /
✓ 200 response
✔ GET /users
✓ 200 response
✔ POST /users/create
✓ 201 response
💡
The --har
option accepts either a single file, ./file.har
, or a directory containing one or more har files,./har-files/
. While the input may be a directory, it cannot contain a glob pattern.
Postman collections
Example
$ optic capture openapi.yml --postman ./postman-collection.json
✔ GET /
✓ 200 response
✔ GET /users
✓ 200 response
✔ POST /users/create
✓ 201 response