This Rust application provides two APIs for retrieving performance-related data. Follow the instructions below to call these APIs.
- Endpoint:
/validator/{validator_id}
- Description: Retrieves the performance of a specific validator as a percentage.
- HTTP Method: GET
- Path Parameter:
validator_id
(String): The ID of the validator.
- Example Request:
curl -X GET http://localhost:8080/validator/25
- Example Response:
Performance: 100%
- Endpoint:
/network_performance
- Description: Retrieves the percentage of active validators in a committee.
- HTTP Method: GET
- Path Parameter:
- none
- Example Request:
curl -X GET http://localhost:8080/network_performance
- Example Response:
Network Performance: 100%
This API call takes about 2 minutes and sometimes due to bad API results, does not return. Please run the code 2-3 times in case you do not get an output after 2 minutes. Sorry for the inconvenience.
-
Start the Rust application by running the following command:
cargo run
-
Once the application is running, you can make API requests using
curl
or any other HTTP client of your choice.-
For the Validator Performance API, use the following command:
curl -X GET http://localhost:8080/validator/{validator_id}
Replace
{validator_id}
with the ID of the validator you want to retrieve the performance for. -
For the Network Performance API, use the following command:
curl -X GET http://localhost:8080/network_performance
-
-
The API will respond with the performance value as a percentage.