Skip to main content

Using `api status` command

After capturing traffic, Optic will be able to tell you if it observed any differences in behavior during the capture session. For example, Optic can tell you in there are any undocumented URLs in the traffic that was observed, or if any of the known endpoints had differences in behavior such as request or response shape differences. If an endpoint sees a new field, or a field that was previously documented is not always present, the field may need to be added to the specification or made optional. Optic will keep track of this for you, and can summarize the differences with api status.

Running api status#

After any capture session, Optic will check for undocumented behavior in the traffic. If it sees any, the capture session will end with the following:

[optic] Observed Unexpected API Behavior. Run "api status"

To get more information on this undocumented behavior in the API traffic, run:

api status
Computing API diffs... Done!   Diffs observed for existing endpoints     (use "api status --review" to review in the UI         POST   /api/todos        PATCH   /api/todos/{id}โœ“  No undocumented URLs observed

In this case, no undocumented URLs were seen in the latest traffic. Two endpoints had differences in behavior. The Optic CLI suggest running api status --review, which opens the Optic Dashboard to the diff page to allow you to review the changes. The dashboard will show how many changes there are to review.

Run api status --review to open the Dashboard, and move on to the next step to review your diffs