Availability: Enterprise and Trial plans, SaaS
API Custom templates are API definitions that you create for use as templates by your organization. Only organization owners can create API custom templates. API custom templates will appear in the Template pulldown when your organization's designers create new APIs.
API custom templates behave in exactly the same way as the built-in templates (e.g., PetStore). That is, when designers/developers create a new API, the contents of the template are initially copied into the current API file. APIs that are created using templates are not linked to their template -- once an API is created and the template is copied, changes to the template are NOT reflected in the created API file.
The standard API templates included with SwaggerHub are only available to copy into newly created API files – the templates themselves cannot be changed or revised. However since you own the definition files of your own API custom templates, they can be edited, renamed, deleted, tested, revised, forked, etc. just like any other API. A custom template can be updated and versioned like any other API definition. It can be public or private. It can be published or not. It can refer to a domain (where supported). You cannot generate code from an API custom template and templates would not normally be actively used as APIs themselves.
Supported API Types
API custom template files can be:
- OpenAPI 2.0 (Swagger)
- OpenAPI 3.0
How to Create New API Custom Templates
If you are an organization owner (not a designer or collaborator), when you click on the Create New button in SwaggerHub, the popup menu will have the choice: Create New Template. From there, the process is the same as creating a API. You can create your template from a blank page by specifying – None – in the Template field. Alternately, you can specify a standard SwaggerHub template or another API custom template file (that you have previously created) to be copied into your new template at creation.
How to Save an Existing API as a Template
If you are an organization owner (not a designer or collaborator), you can save an existing API as a template.
Working with API Custom Templates
All operations on API custom template files (fork, delete, etc.) are identical to the operations on regular API definition files.