Operations on virtual service templates.
Virtual service templates can only be used for the HTTP virtual services.
Actions:
- read: Get a SPECIFIC virtual service template by its id. Use this when you already have a template id.
Do NOT use `list` when you have a specific id — use `read` instead.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace.
id (int): Mandatory. The id of the virtual service template to read.
- list: List virtual service templates in a workspace. Use this to browse or discover templates.
Do NOT use `list` when you need a specific template by id — use `read` instead.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace to list transactions from.
serviceId (int): Optional. The id of the service to list virtual service templates from.
Without this it will list all virtual service templates in the workspace.
limit (int, default=10, valid=[1 to 50]): The number of virtual service templates to list.
offset (int, default=0): Number of virtual service templates to skip.
- create: Create a new virtual service template.
args(VirtualService): A virtual service template object with the following fields:
workspace_id (int): Mandatory. The id of the workspace.
name (str): Mandatory. The name of the virtual service template.
serviceId (int): Mandatory. The id of the service to create the virtual service template in.
noMatchingRequestPreference (str): Mandatory. If not specified use 'return404'.
- update: Update an existing new virtual service template.
args(VirtualService): A virtual service template object with the following fields:
workspace_id (int): Mandatory. The id of the workspace.
template_id (int): Mandatory. The id of the virtual service template.
name (str): Optional. The name of the virtual service template.
serviceId (int): Optional. The id of the service to create the virtual service template in.
noMatchingRequestPreference (str): Optional. If not specified use 'return404'.
- assign_transactions: Assigns the transactions to the virtual service template.
Transactions should belong to the same service as the virtual service template.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace the virtual service template belongs to.
id (int): Mandatory. The id of the virtual service template to assign the transaction to.
transaction_ids (list[int]): Mandatory. The ids of the transactions to assign to the virtual service template.
- unassign_transactions: Unassigns the transactions from the virtual service template.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace the virtual service template belongs to.
id (int): Mandatory. The id of the virtual service template to assign the transaction to.
transaction_ids (list[int]): Mandatory. The ids of the transactions to unassign from the virtual service template.
- assign_configuration: Assigns the configuration to the virtual service template. To unassign configuration, assign configuration with id None.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace the virtual service template belongs to.
id (int): Mandatory. The id of the virtual service template to assign the transaction to.
configuration_id (list[int]): Mandatory. The id of the configuration to assign to the virtual service template.
- assign_keystore: Assign Keystore asset to the Virtual Service Template.
args(dict):
id (int): Mandatory. The id of the Virtual Service Template.
asset_id (int): Mandatory. The id of the keystore asset to assign.
alias (str): Mandatory. The certificate alias to use.
workspace_id (int): Mandatory. The id of the workspace.
- assign_keystore_truststore: Assign Keystore asset to the Virtual Service Template. Asset will be used as both Keystore and Truststore.
Use this action for 2way ssl setup.
args(dict):
id (int): Mandatory. The id of the Virtual Service Template.
asset_id (int): Mandatory. The id of the certificate asset to assign.
alias (str): Mandatory. The certificate alias to use.
workspace_id (int): Mandatory. The id of the workspace.
VirtualServiceTemplate Schema (including full MockServiceTransaction):
{'$defs': {'AssignedAsset': {'properties': {'assetId': {'description': 'The identifier of the asset', 'title': 'Assetid', 'type': 'integer'}, 'assetUsageType': {'description': 'The usage type of the asset', 'title': 'Assetusagetype', 'type': 'string'}, 'alias': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'The asset certificate alias', 'title': 'Alias'}}, 'required': ['assetId', 'assetUsageType'], 'title': 'AssignedAsset', 'type': 'object'}, 'MessagingDestination': {'properties': {'destinationName': {'description': 'Destination name', 'title': 'Destinationname', 'type': 'string'}, 'destinationType': {'description': 'Destination type: QUEUE, TOPIC, or SUBSCRIPTION', 'title': 'Destinationtype', 'type': 'string'}}, 'required': ['destinationName', 'destinationType'], 'title': 'MessagingDestination', 'type': 'object'}, 'MockServiceTransaction': {'properties': {'txnId': {'description': 'Transaction id.', 'title': 'Txnid', 'type': 'integer'}, 'priority': {'default': 10, 'description': 'Transaction Priority. If not specified, defaults to 10.', 'title': 'Priority', 'type': 'integer'}, 'destinations': {'anyOf': [{'items': {'$ref': '#/$defs/MessagingDestination'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'List of messaging destinations.', 'title': 'Destinations'}}, 'required': ['txnId'], 'title': 'MockServiceTransaction', 'type': 'object'}}, 'properties': {'id': {'description': 'The unique identifier of the virtual service template', 'title': 'Id', 'type': 'integer'}, 'name': {'description': 'The name of the virtual service template', 'title': 'Name', 'type': 'string'}, 'serviceId': {'description': 'The unique identifier of the service where the virtual service template belongs', 'title': 'Serviceid', 'type': 'integer'}, 'configurationId': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'default': None, 'description': 'Configuration identifier', 'title': 'Configurationid'}, 'noMatchingRequestPreference': {'description': "Defines the behavior when no matching request is found. Possible values are 'return404' and 'bypasslive'.", 'title': 'Nomatchingrequestpreference', 'type': 'string'}, 'replicas': {'default': 1, 'description': 'The number of replicas for the virtual service template. Always set to 1 for all virtual service templates.', 'title': 'Replicas', 'type': 'integer'}, 'mockServiceTransactions': {'anyOf': [{'items': {'$ref': '#/$defs/MockServiceTransaction'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'List of transaction definitions associated with the virtual service template', 'title': 'Mockservicetransactions'}, 'httpRunnerEnabled': {'default': True, 'description': 'Http runner enabled flag, must be enabled for virtual service template', 'title': 'Httprunnerenabled', 'type': 'boolean'}, 'assets': {'anyOf': [{'items': {'$ref': '#/$defs/AssignedAsset'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'description': 'List of assets', 'title': 'Assets'}}, 'required': ['id', 'name', 'serviceId', 'noMatchingRequestPreference'], 'title': 'VirtualServiceTemplate', 'type': 'object'}