# Save As Templates

#Save Schema as Template

This feature allows you to save schema JSON as templates and later use them as a basis for generating mock data. Below, you will find step-by-step instructions on how to save, manage, and use these templates within the MockAnAPI.

# Table of Contents

  1. Saving a Template
  2. Managing Saved Templates
  3. Using Saved Templates

# 1. Saving a Template

You can save schema JSON as templates using the "Save Template" button located on the top right corner of Schema Editor. This feature allows you to capture the structure and data of an API response for later use.

Steps:

  1. Create or edit an API response Schema in Schema Editor.

  2. Define the response schema in JSON format, including all the necessary fields and data.

  3. Click the "Save Template" button on the top right of the interface.

    Save Template

  4. A dialog box will appear, prompting you to provide a name for the template. Enter a descriptive name that will help you identify the template later.

  5. Confirm "Create Template Button".

# 2. Managing Saved Templates

Saved templates can be easily reused to generate mock data that follows the specified schema. There are two primary methods to access and use your saved templates:

Method 1: Access via Top Right Button

  1. Click the "Saved Templates" button located on the top right corner of the Mock An API interface.

    Saved Templates Button

  2. A dropdown menu will appear, listing your saved templates.

  3. Select a template to use, and it will be loaded into the interface.

Method 2: Access via the Templates Page

  1. Navigate to the "Templates" page.

  2. Click on the template you wish to use.

  3. The template's details will be displayed, and you can use it as a basis for generating mock data.

    Templates Page

# 3. Using Saved Templates

Saved templates can be easily reused to generate mock data that follows the specified schema. All you need to do is start typing tmp_ and all of the saved templates will be suggested via autocomplete.

The selected template will be understood and replaced by the parser with the actual schema JSON you provided when saving the template. You can then make any necessary modifications to the template or use it as is to generate mock API responses.

Consuming a template
Consuming a template

That concludes the documentation for the Mock An API Template Saving Feature. We hope you find this feature useful in creating and managing API response templates for your mocking and testing needs. If you have any further questions or encounter issues, please refer to our support resources for assistance.