Skip to main content

api intercept

Runs traffic against an environment definition from your optic.yml file. It is intended to be a low-friction way to observe traffic to a target, and has minimal options and configurations available. api intercept takes the name of the environment you wish to browse in, such as production, and the browser you want to use as a flag, such as --chrome. You may have multiple environment definitions depending on your project.

Flags & Options#

Intercept takes the name of the environment, as defined in optic.yml, and a flag for the desired browser. Currently suported flags:

  • --chrome

Examples#

To intercept traffic to GitHub's API:

api intercept production --chrome
optic.yml
environments:  production:    host: https://api.github.com    webUI: https://api.github.com/repos/opticdev/optic
Output
[optic] Transparent proxy is running on https://localhost:3700[optic] Monitoring Traffic to https://api.github.com[optic] Optic is observing requests made to https://localhost:3700[optic] Opening your API Diff at http://localhost:34444/apis/1/diffs/local/0a01c76-a3028cd4f056af82efb45f5f8311a376f459d09fda7aa9a5ecb75db688ec4661Waiting for traffic...... done

Issues & Contributing#

Having trouble? Open an issue on GitHub

Have an idea for changing this command? Here's where it lives in the repo. PRs welcome!

Need help or want to talk with us about a use case? Join Contributing on Discord