Skip to main content

HTTP CLI Documentation

The MetricsHub HTTP CLI is a powerful command-line utility for interacting with monitored resources. It supports common HTTP methods (GET, POST, PUT, and DELETE) to validate configurations, troubleshoot connectivity issues, and perform HTTP-based operations directly from the command line. The CLI supports authentication, custom headers, and request body configurations.

Before using the CLI, ensure your platform supports HTTP monitoring by checking the Supported Platforms.

Syntax

httpcli GET|POST|PUT|DELETE URL --username USERNAME --password PASSWORD [--body BODY | --body-file FILE_PATH] [--header HEADER | --header-file FILE_PATH] --timeout TIMEOUT

or

httpcli --method GET|POST|PUT|DELETE --url URL --username USERNAME --password PASSWORD [--body BODY | --body-file FILE_PATH] [--header HEADER | --header-file FILE_PATH] --timeout TIMEOUT

Options

OptionDescriptionDefault Value
--urlThe URL for the HTTP request.None
--methodthe HTTP method to use for the request. Possible values: GET, POST, PUT, DELETE.GET
--headerCustom headers for the request. Can be specified multiple times.None
--header-filePath to a file containing headers for the request.None
--bodyRequest body as a string.None
--body-filePath to a file containing the request body.None
--usernameUsername for HTTP authentication.None
--passwordPassword for HTTP authentication. If not provided, you will be prompted interactively.None
--timeoutTimeout in seconds for the HTTP operation.120
-vEnables verbose mode. Use -v for basic logs, -vv for detailed logs.None
-h, --helpDisplays detailed help information about available options.None

Examples

Example 1: HTTP GET Request with Headers and Body

httpcli get https://dev-01:443/users --username username --password password --header="Content-Type:application/xml" --header="Accept:application/json" --body="<aaaLogin inName='username' inPassword='password' />" --timeout 120

Example 2: HTTP POST Request with Header and Body Files

httpcli post https://dev-01:443/users --username admin --password pass --header-file="/opt/metricshub/header.txt" --body-file="/opt/metricshub/body.txt" --timeout 120

Example 3: HTTP Get Request with Interactive Password Input

httpcli --method get --url https://example.com --username user

The CLI prompts for a password if not provided.