This document provides details about the new APIs that were added as part of Bulk Mock Services operations (Start/Stop/Delete).
Note: For the rest of the Mock Services API documentation, see http://api.blazemeter.com/mock-services.
- Response Format of SM Bulk APIs
- Bulk Start Mock Services API
- Bulk Stop Mock Services API
- Bulk Delete Mock Services API
- MAR Bulk Deploy
- Switch VSE Mode
Response Format of SM Bulk APIs
When performing a bulk action on service mocks, a tracking object will be given as a response. This tracking object can be monitored in order to know the status of the bulk action.
The trackingID field of the tracking object can be used with the existing tracking API to look up the current status of the bulk action:
Get tracking object by ID - GET /api/v1/trackings/{trackingId}
For bulk actions, a tracking object of the type MASTER_TRACKING is used, which contains one or more child tracking objects in its serviceMockTrackingDtos field; each of these child tracking objects represents the status of the action for one of that service mocks that the bulk action is being performed on.
Sample Bulk Action response
{
"apiVersion": 1,
"error": null,
"result": [
{
"id": null,
"code": 0,
"message": null,
"trackingDto": {
"trackingId": "f03ca79a-610f-4aa9-b708-284aefef7d14",
"status": "RUNNING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/f03ca79a-610f-4aa9-b708-284aefef7d14",
"data": {
"dataType": "MASTER_TRACKING",
"serviceMockTrackingDtos": [
{
"serviceMockId": 1,
"serviceMockName": "MockService-Jan_26_08:57:32:679 PM",
"trackingDto": {
"trackingId": "7676187b-68f7-4508-b380-dcaa310aaf8f",
"status": "PENDING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/7676187b-68f7-4508-b380-dcaa310aaf8f",
"data": {
"dataType": "CONFIGURATION",
"values": [
39488
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
],
"requestId": "4035070a00714041"
}
Bulk Start Mock Services API
API - PATCH
/api/v1/workspaces/{workspaceId}/service-mocks
Similar to other bulk operations
- Swagger link - https://mock.blazemeter.com/swagger-ui.html#/Service%20Mock/bulkMockOperationsUsingPATCH
Required request body fields for mock services:
- action (String) - Must be set to "START"
- mockServiceIds (Number[]) - List of Mock Service Ids that need to be deployed
- credentialsId (String) - SV Bridge ONLY - ID of SV credentials to use when authenticating with DevTest APIs
- username (String) - SV Bridge ONLY - Base64-encoded username to use when authenticating with DevTest APIs
- password (String) - SV Bridge ONLY - Base64-encoded password to use when authenticating with DevTest APIs
Sample request
curl --request PATCH \
--url http://localhost:3000/api/v1/workspaces/28906/service-mocks \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{
"action": "START",
“mockServiceIds”:[1],
“credentialsId”: “myCredentialsId”,
“username”: “base64EncodedValue”,
“password”: “base64EncodedValue”
}'
Sample response
{
"apiVersion": 1,
"error": null,
"result": [
{
"id": null,
"code": 0,
"message": null,
"trackingDto": {
"trackingId": "f03ca79a-610f-4aa9-b708-284aefef7d14",
"status": "RUNNING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/f03ca79a-610f-4aa9-b708-284aefef7d14",
"data": {
"dataType": "MASTER_TRACKING",
"serviceMockTrackingDtos": [
{
"serviceMockId": 1,
"serviceMockName": "MockService-Jan_26_08:57:32:679 PM",
"trackingDto": {
"trackingId": "7676187b-68f7-4508-b380-dcaa310aaf8f",
"status": "PENDING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/7676187b-68f7-4508-b380-dcaa310aaf8f",
"data": {
"dataType": "CONFIGURATION",
"values": [
39488
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
],
"requestId": "4035070a00714041"
}
Bulk Stop Mock Services API
API - PATCH
/api/v1/workspaces/{workspaceId}/service-mocks
Similar to other bulk operations
- Swagger link - https://mock.blazemeter.com/swagger-ui.html#/Service%20Mock/bulkMockOperationsUsingPATCH
Required request body fields for mock services:
- action (String) - Must be set to "STOP"
- mockServiceIds (Number[]) - List of Mock Service Ids that need to be deployed
- credentialsId (String) - SV Bridge ONLY - ID of SV credentials to use when authenticating with DevTest APIs
- username (String) - SV Bridge ONLY - Base64-encoded username to use when authenticating with DevTest APIs
- password (String) - SV Bridge ONLY - Base64-encoded password to use when authenticating with DevTest APIs
Sample request
curl --request PATCH \
--url http://localhost:3000/api/v1/workspaces/28906/service-mocks \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{
"action": "STOP",
“mockServiceIds”:[1],
“username”: “base64EncodedValue”,
“password”: “base64EncodedValue”
}'
Sample response
{
"apiVersion": 1,
"error": null,
"result": [
{
"id": null,
"code": 0,
"message": null,
"trackingDto": {
"trackingId": "f03ca79a-610f-4aa9-b708-284aefef7d14",
"status": "RUNNING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/f03ca79a-610f-4aa9-b708-284aefef7d14",
"data": {
"dataType": "MASTER_TRACKING",
"serviceMockTrackingDtos": [
{
"serviceMockId": 1,
"serviceMockName": "MockService-Jan_26_08:57:32:679 PM",
"trackingDto": {
"trackingId": "7676187b-68f7-4508-b380-dcaa310aaf8f",
"status": "PENDING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/7676187b-68f7-4508-b380-dcaa310aaf8f",
"data": {
"dataType": "CONFIGURATION",
"values": [
39488
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
],
"requestId": "4035070a00714041"
}
Bulk Delete Mock Services API
API - PATCH
/api/v1/workspaces/{workspaceId}/service-mocks
Similar to other bulk operations
- Swagger link - https://mock.blazemeter.com/swagger-ui.html#/Service%20Mock/bulkMockOperationsUsingPATCH
Required request body fields for mock services:
- action (String) - Must be set to "DELETE"
- mockServiceIds (Number[]) - List of Mock Service Ids that need to be deployed
- credentialsId (String) - SV Bridge ONLY - ID of SV credentials to use when authenticating with DevTest APIs
- username (String) - SV Bridge ONLY - Base64-encoded username to use when authenticating with DevTest APIs
- password (String) - SV Bridge ONLY - Base64-encoded password to use when authenticating with DevTest APIs
Sample request
curl --request PATCH \
--url http://localhost:3000/api/v1/workspaces/28906/service-mocks \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{
"action": "DELETE",
“mockServiceIds”:[1],
“username”: “base64EncodedValue”,
“password”: “base64EncodedValue”
}'
Sample response
{
"apiVersion": 1,
"error": null,
"result": [
{
"id": null,
"code": 0,
"message": null,
"trackingDto": {
"trackingId": "f03ca79a-610f-4aa9-b708-284aefef7d14",
"status": "RUNNING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/f03ca79a-610f-4aa9-b708-284aefef7d14",
"data": {
"dataType": "MASTER_TRACKING",
"serviceMockTrackingDtos": [
{
"serviceMockId": 1,
"serviceMockName": "MockService-Jan_26_08:57:32:679 PM",
"trackingDto": {
"trackingId": "7676187b-68f7-4508-b380-dcaa310aaf8f",
"status": "PENDING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/7676187b-68f7-4508-b380-dcaa310aaf8f",
"data": {
"dataType": "CONFIGURATION",
"values": [
39488
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
],
"requestId": "4035070a00714041"
}
MAR Bulk Deploy
API - PATCH
/api/v1/workspaces/{workspaceId}/service-mocks/mar/deploy
Required request body fields for MAR mock services:
- action (String) - Must be set to "DEPLOY" for bulk deploy of MAR assets
- assetIds (Number[]) - List of asset ids in a format like [123, 234, 567]
- harborId (String) - 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.
- shipId (String) - The identifier of a 'ship', an agent in a logical container on the BlazeMeter end in your private on-premise location (aka 'harbor').
Optional request body fields for MAR mock services:
- tags (String) : List of tags as strings.
- concurrentCapacity (Number) - The number of concurrent requests that the MAR Mock Service should support
- thinkTimePercent (Number) - Think time is a synthetic delay inserted between test steps to ensure the test script moves at a human pace.
- executionMode (String) - Setting that controls the runtime behavior of a virtual service. Valid options are MOST_EFFICIENT, STAND_IN, LIVE_INVOCATION, FAILOVER, LEARNING_MODE, DYNAMIC. Form more information, see Execution Mode.
Sample request
curl --request PATCH \
--url https://mock.blazemeter.com/api/v1/workspaces/27103/service-mocks/mar/deploy \
--header 'accept: application/json' \
--header 'authorization: Basic ABC123DEF456==' \
--header 'content-type: application/json' \
--data '{
"action": “DEPLOY”,
"assetIds": [123],
"harborId": “abc123”,
"shipId": “def234”,
"tags": [‘test’, ‘team1’],
"thinkTimePercent": 100,
"concurrentCapacity": 1,
"executionMode": “MOST_EFFICIENT”
}'
Sample response
{
"apiVersion": 1,
"error": null,
"result": [
{
"id": null,
"code": 0,
"message": null,
"trackingDto": {
"trackingId": "f03ca79a-610f-4aa9-b708-284aefef7d14",
"status": "RUNNING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/f03ca79a-610f-4aa9-b708-284aefef7d14",
"data": {
"dataType": "MASTER_TRACKING",
"serviceMockTrackingDtos": [
{
"serviceMockId": 1,
"serviceMockName": "MockService-Jan_26_08:57:32:679 PM",
"trackingDto": {
"trackingId": "7676187b-68f7-4508-b380-dcaa310aaf8f",
"status": "PENDING",
"errors": [
],
"warnings": [
],
"trackingUrl": "/api/v1/trackings/7676187b-68f7-4508-b380-dcaa310aaf8f",
"data": {
"dataType": "CONFIGURATION",
"values": [
39488
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
]
},
"created": 1611698461,
"createdBy": null,
"updated": 1611698461,
"updatedBy": "user@example.com",
"ended": null
}
}
],
"requestId": "4035070a00714041"
}
Switch VSE Mode
API - PATCH
/api/v1/workspaces/{workspaceId}/blazevses/{blazevseid}
Required request body field to switch VSE mode:
- performanceVse (boolean) - ‘true’ denotes VSE is in performance mode and ‘false’ denotes VSE in functional mode.
Sample request
curl --request PATCH \
--url https://mock.blazemeter.com/api/v1/workspaces/27103/blazevses/12345 \
--header 'accept: application/json' \
--header 'authorization: Basic ABC123DEF456==' \
--header 'content-type: application/json' \
--data '{
"performanceVse": false
}'
Sample response
{
"apiVersion" : 1,
"error" : null,
"result" : {
"id" : 276,
"workspaceId" : 27090,
"harborId" : "600929ca63d0382c7038c7f3",
"shipId" : "600929d28a5db83de06eb9b6",
"lastHeartBeat" : 1611216065,
"locationName" : "Test-PL",
"lisaProperties" : null,
"status" : "RUNNING",
"statusMessages" : null,
"msRunningCount" : null,
"type" : null,
"memoryUsage" : null,
"totalTxnCount" : null,
"assets" : [ ],
"serviceMocks" : null,
"pendingUpdate" : false,
"containerName" : "blazevse276v1611214763321",
"performanceVse" : false
},
"requestId" : "562ade456b6759f8”
}
0 Comments