Organise mocks with tags
Before you begin
- Role
- Viewer or higher to see tags and filter by them and Editor or higher to add, remove and change tags.
An OpenAPI import or a recording session can leave a project with hundreds of mocks. Tag them, such as orders or v2, to find a group again with one filter and change it in one action.
-
On the project’s Mocks tab, select the mock’s name.
-
In Tags, type a tag and press Enter, or type a comma after it. The project’s other tags are offered as you type.
-
Select Save mock.
Result
Section titled “Result”The mock’s row on the Mocks tab shows its first three tags, then how many more, such as +2. Hover over them to read every tag. Selecting a tag filters the list to the mocks that carry it.
A tag is stored in lowercase, so Orders becomes orders. Tags only help you find mocks: a tag never changes what a mock answers, and adding or removing one adds no entry to the mock’s version history.
What a tag can be
Section titled “What a tag can be”A tag is 1 to 64 letters, digits and . _ : / -, starting with a letter or a digit, such as orders, v2, api.stripe.com or team/payments. Spaces are refused: write order-history, not order history. A mock carries at most 10 tags.
Filter the list
Section titled “Filter the list”On the Mocks tab, Filters beside the search box opens the filters that narrow the list, and counts those in force while it is closed. Every filter you set applies at once.
| Filter | Shows |
|---|---|
| Any tag | Mocks carrying every tag you choose. Each tag is listed with how many mocks carry it |
| Any contract link | Mocks Linked to any operation of the project’s OpenAPI contract, Not linked to an operation, or linked to one operation you choose. Offered while the project has a contract |
| A response fails to render | Mocks whose response will not render, the ones marked Won’t render in the list |
The address of a filtered list, such as …/mocks?tags=orders,errors, can be bookmarked or shared. Clear filters removes them all.
Change every mock that matches
Section titled “Change every mock that matches”-
Filter the list to the mocks you want to change.
-
Select Select every mock on this page.
-
When the filters match more mocks than one page holds, select Select all … matching, such as Select all 240 matching.
-
Select Activate, Deactivate, Tag or Delete.
The bar above the list says All 240 mocks matching these filters are selected. Delete asks first, naming how many mocks it removes.
If the number of matching mocks changed since the list loaded, because someone added or removed one, nothing is changed. The list loads again with the same filters and says how many match now, such as “The filter now matches 241 mocks, not the 240 you saw. Nothing was changed; reload the list and try again.” Check the list, and select the mocks again. See Mock selection changed.
Ticking or unticking a mock, or changing a filter, the sort or the page, goes back to selecting the mocks you tick.
While mocks are selected, the list stays as it is when mocks change elsewhere, and says Mocks changed elsewhere. Select Show changes to see them; it clears the selection. See Changes made elsewhere.
Add or remove a tag on several mocks
Section titled “Add or remove a tag on several mocks”-
Tick the mocks, or select every matching mock as above.
-
Select Tag.
-
Under Add tags, Remove tags, or both, enter the tags.
-
Select Change tags.
MockHub says how many mocks changed, such as Tags changed on 12 mocks. When a mock would end with more than 10 tags, nothing changes and the dialog names that mock, such as “Mock “Get order” would carry 11 tags; a mock carries at most 10. Nothing was changed.”
To rename a tag, filter by the old tag, select every matching mock, and add the new tag while removing the old one.
Tags MockHub adds
Section titled “Tags MockHub adds”- Importing an OpenAPI document tags each mock it creates with the tags of its operation in the document, such as
Pet Storeaspet-store. Updating the document later leaves the tags of existing mocks as they are, so a tag you removed does not come back. - Promoting a capture tags the mock with the host of the upstream that answered the capture, such as
api.example.com, orinboxfor a post to the webhook inbox.
Limits
Section titled “Limits”- One action covers at most 1,000 mocks. Narrow the filter for more.
- Several tags in Any tag find the mocks that carry all of them, not any of them. There is no filter for mocks without a tag.
- Ask AI… and Activate in place of … take the mocks you tick, not every matching mock.
- Request logs, insights and alert rules cannot be filtered by tag.
- A capture recorded before MockHub kept which upstream answered it is tagged with the upstream the project names when you promote it.
- Tags have no colour or description, and there are no folders.