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} ]}'
Create a Virtual Service Request Attributes
Attributes
-
description
stringThe description of the new Virtual Service.
-
endpointPreference
stringChoose HTTP or HTTPS.
-
type
stringSet the type to "TRANSACTIONAL" for transactional Virtual Services. The legacy value "SV" for DevTest MAR Mock Services is deprecated.
-
harborId
stringThis identifier was used in MAR-based Mock Services (EOL) only. The identifier of the private on-premise location (aka 'harbor'), a logical container on the BlazeMeter end that contains one or more agents (aka 'ships') on your end.
-
liveSystemHost
stringThe host of the live system.
-
liveSystemPort
integerThe port of the live system.
-
name
stringThe name of the new Virtual Service.
-
noMatchingRequestPreference
stringWhat to do if there are no matching requests. Choose either
return404
to return "no match found", or choosebypasslive
to redirect to the 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 that contains this Virtual Service.
-
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').
-
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. -
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
}