Using the doc Command
The doc command allows you to quickly access API reference information for specific endpoints.
To get information about a specific API endpoint:
/wallets/mpc/vaults endpoint, including its description, parameters, and response format.
Describing API Endpoints with HTTP Methods
You can use the-d or --describe flag with the HTTP method commands (get, post, put, delete) to get help on specific API endpoints.
For example, to get information about a GET endpoint:
/wallets, which lists all wallets.
Getting Help on Specific Parameters
You can also use the-d or --describe flag to get help on one or multiple parameters for an API endpoint. This is particularly useful when you need information about specific fields in the request.
To get help on a single parameter:
name parameter for the /wallets/mpc/vaults endpoint, which creates a new MPC vault.
To get help on multiple parameters:
name and vault_type parameters for creating an MPC vault.
Updating the OpenAPI Specification
The Cobo CLI uses an OpenAPI specification to provide accurate and up-to-date information about the API. This specification is automatically updated on a weekly basis to ensure you have access to the most recent API documentation. However, if you need to force an update before the next scheduled update, you can use thedoc command with the -u flag:
-
It sends a GET request to the Cobo GitHub repository to fetch the latest OpenAPI specification file from:
https://raw.githubusercontent.com/CoboGlobal/developer-site/master/v2/cobo_waas2_openapi_spec/dev_openapi.yaml - If the request is successful, it downloads the content of the YAML file.
-
The CLI then saves this file to your local configuration directory, typically as
openapi.yamlin the Cobo CLI configuration folder. - If the download and save operations are successful, you’ll see a message: “OpenAPI specification file downloaded successfully.”
The automatic weekly update occurs when you run any command that requires the OpenAPI specification. If the spec file is older than one week, the CLI will attempt to update it before proceeding with the command.
If there’s an error during the manual or automatic update process, such as network issues or permission problems, the CLI will display an error message explaining what went wrong.
Using a Custom API Specification File
If you have a custom OpenAPI specification file, you can use it with the Cobo CLI. This is useful for testing or working with different versions of the API. To use a custom specification file:/path/to/custom_spec.yaml with the actual path to your custom specification file.
Using a custom specification file will override the default OpenAPI specification for that command only. It won’t affect other commands or future uses of the CLI.
