Using gRPCurl with BOS API
Here's a quick start guide for using grpcurl with the BOS Public API, streamlined into step-by-step commands, if you want to get more detailed information about the available fields and their values, refer to the Using grpcurl with the BOS Public API page.
1. Download and Install grpcurl:
- Visit the grpcurl releases page and download the latest version for your platform.
2. Use Port 50051 for BOS Public API:
- The default port for the BOS Public API is
50051.
3. Request Authentication Token:
Sample Request:
- Ensure to replace
<MINER_IP>with the actual IP address of your miner.
Expected Response:
4. Example of Get Request (Get Miner Details):
Sample Request:
- Replace
<YOUR_SESSION_TOKEN>with the token obtained from the login response and,<MINER_IP>with the actual IP address of your miner.
Expected Response:
- Example of Set Request (Set Power Target):
Sample Request:
-
Replace
<YOUR_SESSION_TOKEN>with the token obtained from the login response and,<MINER_IP>with the actual IP address of your miner. -
Set the
wattvalue to your desired power target. Be careful about the power target value you set, as it can affect the miner's performance and stability. -
The
saveActionfield specifies how changes made via API calls should be handled regarding the miner's configuration.
Expected Response:
If you need to get more information about the available fields and their values, refer to the Using grpcurl with the BOS Public API page.
6. Example of Stream Request (GetMinerStatus):
Sample Request:
- Replace
<YOUR_SESSION_TOKEN>with the token obtained from the login response and,<MINER_IP>with the actual IP address of your miner.
Expected Response:
- For streaming responses,
grpcurlwill print out each message as it's received until the server closes the stream or until you terminate the command (e.g., by pressingCtrl+C).
7. Additional Resources:
Save Action Field Explanation
The SaveAction field specifies how changes made via API calls should be handled regarding the miner's configuration:
SAVE_ACTION_UNSPECIFIED: Default behavior without explicit save action.SAVE_ACTION_SAVE: Saves changes without applying them immediately.SAVE_ACTION_SAVE_AND_APPLY: Saves and applies changes right away.SAVE_ACTION_SAVE_AND_FORCE_APPLY: Forces immediate application of changes, bypassing any normal checks.
Flags and Options
The following are some common flags and options used with grpcurl commands:
-plaintextoption indicates that the connection should not be encrypted. This is suitable for local testing.-vflag is to get verbose output, helping understand the gRPC calls better and display the request and response headers.-dflag is used to specify the request data.-Hflag is used to specify a request header.-msg-templateoption is used to generate a message template for the request, providing a skeleton with all the fields you need to populate for your actual request.-import-pathoption is used to specify the path to the directory containing the proto files.-protooption is used to specify the proto file for the service you are interacting with.