Hoverfly Cloud
Visit Our Main SitePricingTry Hoverfly Cloud
  • Introduction
  • Use cases for API Simulation
  • Key concepts
  • What's New
  • Dashboard
  • Simulation
    • Create simulations
    • Configuring Request Matchers
      • JSON Request Matchers on the Body
        • EXACT Matcher
        • JSON Matcher
        • JSON Partial Matcher
        • JSONPath Matcher
        • Regular Expression Matcher
      • Handling the response when Hoverfly cannot match
    • Building a JSON Response
      • Using a JSON object from the Request
      • Looping over a JSON array from the Request
    • Simulating Webhooks and Callbacks
    • Using templating in simulations
      • Render back any part of the Request
      • Render synthetic data
      • Faker functions
      • Render dates and times with offsets
      • Conditional logic
      • Looping over arrays
      • Variables and Arrays
      • Arithmetic operations
      • String operations
      • Validation operations
      • Simulating a persistent backend
      • Transitioning state between requests
      • Combining and nesting templating functions
      • Useful helper functions
      • Avoiding HTML encoding in function return values
    • Using data sources in simulations
      • Querying data sources
      • Updating data in data sources
      • Deleting data from data sources
      • Inserting data into a data source
      • Guidance on using the SQL like syntax
    • Working with Simulation Files
  • Service
    • Start a new service
    • Use a service
    • Update a service
    • Configuring Journal Indexing
  • Command line interface
    • Hoverfly Cloud CLI commands
  • Tutorials
    • Quickstart
    • Creating simulations and services
      • Tutorial 1: Create a service and simulation manually
      • Tutorial 2: Create a service and simulation by importing from a Swagger specification
      • Tutorial 3: Create a service and simulation by capturing real API traffic
    • Response Templating
      • Tutorial 4: Response Templating
    • Hoverfly service modes
      • Tutorial 5: Simulate, Capture, Spy and Passthrough modes
    • Automating with the CLI and API
      • Tutorial 6: Using the CLI and the Hoverfly Cloud API
Powered by GitBook
On this page
  • Download
  • Installation
  • Getting started
  • Start a service
  • Update the simulation
  • Reset a service
  • Delete a service
  • Start a capture service
  • Update the proxy mode
  • Export a simulation

Command line interface

Use the Hoverfly Cloud command-line interface (CLI) to manage your API simulations and virtual services from the terminal.

PreviousConfiguring Journal IndexingNextHoverfly Cloud CLI commands

Last updated 2 months ago

hcc is a multi-purpose command line interface for Hoverfly Cloud. It provides a convenient way to manage your Hoverfly Cloud virtual services and automate their management. Either for ad-hoc actions via the command line or integrated into scripts that are used by Continuous Integration and DevOps tools such as Jenkins.

You can capture traffic within your network and publish the simulation to your account with hcc.

See the for a full list of commands.

Download

Installation

Download the correct version using the links above. Unpack the zip file and you are good to go.

You may copy the unpacked binary to /usr/local/bin (for Mac and Linux), so that you can run hcc without specifying the full path.

Verifying the installation by running

hcc version

It should print out the version, such as v2.0.0

Getting started

Run the following command to configure hcc to authenticate with your account:

hcc config set api-token {your API token}

The API token is stored in ~/.hcc/config.yaml for future use.

Start a service

Launch a virtual service from the command line:

  • Using a local simulation file.

hcc service start my-service --simulation-file FILE_NAME
  • Or using a simulation created on Hoverfly Cloud.

hcc service start my-service --simulation-name SIMULATION_NAME

Update the simulation

Update the simulation data on a service:

  • Using a local simulation file.

hcc service update my-service --simulation-file FILE_NAME
  • Or using a simulation created on Hoverfly Cloud.

hcc service update my-service --simulation-name SIMULATION_NAME

Reset a service

You can wipe the simulation data, journal and states by reseting the service:

hcc service reset my-service

Delete a service

Delete a service from the command line:

hcc service delete my-service

Start a capture service

Launch a Hoverfly Cloud service to capture a remote API from the command line:

hcc service start my-service --mode capture --target-url https://example-api.com

You should pass the base URL of the API to the --target-url flag.

Update the proxy mode

If you have started a service with proxy enabled by setting the --target-url and --mode . You can switch the mode using the following command:

hcc service update my-service --mode spy

Export a simulation

Export the simulation data from a service to a new simulation resource on your Hoverfly Cloud account:

hcc service export my-service --simulation-name SIMULATION_NAME

Your service must be running, and the SIMULATION_NAME must not conflict with an existing name.

After you download and install the CLI, on the Account page.

If your service contains simulation data that is not saved, it will be lost. You may want to first.

for a list of available proxy modes.

Reference page
MacOS 64bit
Windows 64bit
Windows 32bit
Linux 64bit
Linux 32bit
create an API token
export the simulation
See here