Service Virtualization Bulk Operations APIs
This document provides details about the new APIs that were added as part of Bulk Service Virtualization operations (Start/Stop/Delete).
- Response Format of SM Bulk APIs
- Bulk Start Service Virtualization API
- Bulk Stop Service Virtualization API
- Bulk Delete Service Virtualization API
Response Format of Service Virtualization Bulk APIs
When performing a bulk action on virtual services, 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 virtual service 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 Service Virtualization 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 the virtual service:
- action (String) - Must be set to "START"
- mockServiceIds (Number[]) - List of virtual service Ids that need to be deployed
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 Service Virtualization 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 the virtual service:
- action (String) - Must be set to "STOP"
- mockServiceIds (Number[]) - List of virtual service Ids that need to be deployed
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 Service Virtualization 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 the virtual service:
- action (String) - Must be set to "DELETE"
- mockServiceIds (Number[]) - List of virtual service Ids that need to be deployed
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]
}'
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"
}