Using HAR files or Postman collections
If you already have HAR files or Postman collections you can use them with Optic via the
--postman capture options.
When using the
--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.
# 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
--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.
$ optic capture openapi.yml --postman ./postman-collection.json ✔ GET / ✓ 200 response ✔ GET /users ✓ 200 response ✔ POST /users/create ✓ 201 response