Rest API

It is possible to run rust-code-analysis-cli as a HTTP service using REST API to share data between client and server. We will use the port 9090 to show you the possible ways to interact with the server.


rust-code-analysis-cli can act as a server running on your localhost at a specific port.

rust-code-analysis-cli --serve --port 9090

The --port option sets the port used by the server. One possible value could be 9090.


If you want to ping the server, make a GET request at this URL:


To get metrics formatted as a json file, make a POST request at this URL:{filename}&unit={unit}

The filename parameter represents the path to the source file to be analyzed, while unit is a boolean value that can assume only 0 or 1. The latter tells rust-code-analysis-cli to consider only top-level metrics, while the former returns detailed metrics for all classes, functions, nested functions, and other sub-spaces.