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
  • CSV Data sources
  • Journal Templating
  1. Simulation
  2. Using templating in simulations

Simulating a persistent backend

Hoverfly Cloud supports two distinct mechanisms for simulating a persistent backend. Data sources, and Journal templating. Both of them depend on templating.

PreviousValidation operationsNextTransitioning state between requests

Last updated 3 months ago

CSV Data sources

You can upload up to 10 CSV files as data sources when editing your simulation from the Simulation tab.

This is configured at the simulation level, and the ability to store and retrieve tabular data within this data store is scoped at the service instance level.

You can both query data from a CSV data source as well as manipulate data within a data source by adding to it and deleting from it. Hoverfly supports a number of templating methods for simple read, update and delete functions. In addition Hoverfly supports a templating function that allows simple SQL like commands for SELECT, UPDATE and DELETE.

This is only available to enterprise customers.

You can read about this approach

Journal Templating

Hoverfly Cloud has the ability to retrieve from memory any past request that has been indexed with a key you provide, and then retrieve any part of that request or response for processing in your current response.

This is configured at the service instance level, and the ability to store and retrieve historical requests and responses is scoped at the service instance level.

This ability to look up in history, is one of the ways Hoverfly supports the mocking of a persistent back-end service. This is only available to enterprise customers.

You can read about this approach

here
here