Create Virtual Services
To create a Virtual Service in your workspace, you need to know your Workspace identifier. The sample code uses a workspaceId
of 123456
. Use the actual ID value of your Workspace.
The response contains a Virtual Service identifier that you should note down. You will need this serviceMockId
when you want to configure, deploy, or delete this Virtual Service later.
Minimum Parameters for creating a Virtual Service
The following parameters are the base parameters required to create a Virtual Service.
Create a Virtual ServiceMinimum Configuration Sample
curl 'https://mock.blazemeter.com/api/v1/workspaces/123456/service-mocks' \
-X POST \
-H 'accept: application/json;charset=UTF-8' \
-H 'Content-Type: application/json' \
-d '{ "description": "string", "endpointPreference": "string",
"harborId": "string", "id": 0, "type": "TRANSACTIONAL",
"liveSystemHost": "string", "liveSystemPort": 0, "name": "string",
"noMatchingRequestPreference": "string", "noMatchingRequestTxnId": 0,
"serviceId": 123, "shipId": "string", "thinkTime": 0,
"mockServiceTransactions": [ {"txnId":1, "priority":9} ],
"httpRunnerEnabled" : true, "messagingRunnerEnabled": false }'
Create a Virtual Service Request Attributes
Attributes
-
description
stringThe description of the new Virtual Service.
-
endpointPreference
stringChoose HTTP or HTTPS.
-
httpRunnerEnabled
BooleanThe HTTP Runner is the default runner for virtual services. Either "httpRunnerEnabled" or "messagingRunnerEnabled" must be set to true.
-
messagingRunnerEnabled
BooleanThe Messaging Runner supports MQ Messaging in virtual services. Either "httpRunnerEnabled" or "messagingRunnerEnabled" must be set to true. By default, this is set to false.
-
httpRunnerOverrideKeystore
BooleanEnables the keystore override for the HTTP Runner. This setting will apply the keystore certificates attached in the SSL settings to the runner keystore. Default: true. If a Messaging Runner needs to use SSL authentication, but the HTTP Runner does not, then set this to false.
-
httpRunnerOverrideTruststore
BooleanEnables the truststore override for the HTTP runner. This setting will apply the keystore certificates attached in the SSL settings to the runner truststore. Default: true. If a Messaging Runner needs to use SSL authentication, but the HTTP Runner does not, then set this to false.
-
type
stringSet the type to "TRANSACTIONAL" for transactional Virtual Services. The legacy value "SV" for DevTest MAR-based Mock Services (EOL) is deprecated.
-
liveSystemHost
stringThe host of the live system.
-
liveSystemPort
integerThe port of the live system.
-
name
stringThe name of the virtual service.
-
noMatchingRequestPreference
stringDetermines what to do if there are no matching requests. Choose either
return404
to return "no match found", or choosebypasslive
to redirect to the configured live system. -
noMatchingRequestTxnId
integerIf there are no matching requests, this is the Transaction ID that did not match.
-
serviceId
integerThe identifier of an existing Service container that contains this virtual service.
-
thinkTime
integerThink time is a synthetic delay inserted between test steps to ensure the test script moves at a human pace.
-
mockServiceTransactions
arrayThe Transaction identifiers that are assigned to this Virtual Service, as a list of
{"txnId":1,"priority":9}
entries. The field `txnId` is the identifier of an existing transaction that belongs to this service mock. The field `priority` is an integer value from 1 to 10 inclusive, where a lower number represents the desire to match the request first. You can leave the list empty and assign Transactions later. -
shipId
stringThis identifier was used in MAR-based Mock Services (EOL) only. The identifier of a 'ship', an agent in a logical container on the BlazeMeter end in your private on-premise location (aka 'harbor').
-
harborId
stringThis identifier was used in MAR-based Mock Services (EOL) only. The identifier of the private on-premise location (also know as 'harbor'), a logical container on the BlazeMeter end that contains one or more agents (also know as 'ships') on your end.
Response201 Created
{
"apiVersion": 0,
"error": "string",
"errors": [
{
"code": "string",
"message": "string",
"severity": "WARN"
}
],
"limit": 0,
"link": "string",
"requestId": "string",
"result": {
"created": "2020-06-17T13:04:42.949Z",
"createdBy": "string",
"createdDate": "string",
"description": "string",
"endpointPreference": "string",
"harborId": "string",
"httpEndpoint": "string",
"httpsEndpoint": "string",
"id": 0,
"isNew": true,
"liveSystemHost": "string",
"liveSystemPort": 0,
"mockServiceTransactions": [
{
"priority": 0,
"txnId": 0
}
],
"name": "string",
"noMatchingRequestPreference": "string",
"noMatchingRequestTxnId": 0,
"replicas": 0,
"serviceId": 0,
"serviceName": "string",
"shipId": "string",
"status": "STOPPED",
"thinkTime": 0,
"type": "TRANSACTIONAL",
"updated": "2020-06-17T13:04:42.949Z",
"updatedBy": "string",
"updatedDate": "string"
},
"skip": 0,
"total": 0
}