In Mockoon, a data bucket is a key value store where you can create reusable content or data for your routes.
The data buckets are defined at the environment level and are generated when the server starts. It means that their state persists between each call (see below).
To create a new data bucket, open the Data options by clicking on the tab at the top of the window:
Add a new data bucket by clicking on the "plus" button:
You can change the data bucket title and content on the right part of the screen.
Mockoon will automatically attribute a new unique ID to your data bucket. You can use this ID to reference the data using the
data helpers. To retrieve a bucket's unique ID, look in the footer under the data bucket content or right-click on a bucket name in the list and click on "Copy ID to clipboard".
Mockoon will always try to parse the data bucket's content from JSON to allow you to reference only part of it using the
data helpers and an object path.
You can easily combine your data bucket contents by referencing other data buckets using the
⚠️ However, data buckets are generated in the order they are defined in the environment. As a consequence, you cannot reference a data bucket that is defined after the current one.
Data buckets are generated when the server starts in the order they are defined in the environment. Their state persist during all mock API calls. To regenerate a data bucket's content, restart the mock server.
If a data bucket contains request helpers, Mockoon will generate the bucket content only after the first call made to a route using this data bucket (by referencing it directly or using a data helper). It allows you to create bucket "configuration" routes that you can call programmatically with the content you want to reuse in your bucket using the request helpers (