Virtual Service Invoke API

This document describes the functionality to create and manage a virtual service using the Virtual Service Invoke RESTful API.
dts103
This document describes the functionality to create and manage a virtual service using the
Virtual Service Invoke
RESTful API.
3
Overview
Requirements
  • The
    DevTest
    registry must be running.
  • A Virtual Service Environment (VSE) must be running.
  • API Authentication must use the
    DevTest
    user credentials.
Endpoint
The root URL for this API is:
http://localhost:1505/lisa-virtualize-invoke/api/v2/
Authentication
This API requires an authentication using the
DevTest
credentials. Use the Authorization request header for authentication. The following is an example using curl:
curl -X GET -H "Authorization: Basic XXXXXXXXXXXXX" -H "Cache-Control: no-cache" "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses"
Reference
For more reference, a SWAGGER framework is set up in the following URLs for documentation and testing purposes:
Parameters
The following table is a list of parameters that are used in this document:
Parameter
Description
{vseId}
The VSE server id
{sessionId}
A builder session id
{tpId}
A transport protocol id
{dpId}
A data protocol id
{recorderId}
The recorder id
{bundleId}
A transaction bundle id
{inputContainerId}
An input container id
{contentId}
A content id
{processorId}
An input processor id
{transactionId}
A transaction id
{procId}
A bundle processor id
{serviceId}
A virtual service id
Glossary
VS
Virtual Service
VSE
Virtual Service Environment
Builder Session
Contains all the information necessary for creating or editing a VS, such as its configuration (transport protocol) and content (transactions).
Transport Protocol
Holds all the configuration for a Builder Session, most importantly the type of protocol, the recording, and target endpoints.
Input Container
A server-side container that holds uploaded artifacts (RR pairs, spec documents, for example) until they can be processed to produce transactions.
Input Processor
Responsible for processing the contents of the Input Container to produce transactions out of the provided artifacts.
Response Codes
The following table is a list of response codes that this API returns:
Code
Description
200
Successful
201
Created (success)
202
Accepted (success)
204
No Content (success)
400
Bad request (invalid input data)
404
Not Found
500
Server Error
Create a Virtual Service By Recording
Get the VSE Id
Request:
GET /vses
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m" } } }
A successful response returns an array of 
VSE
 Server JSON objects. Choose the 
VSE
 to use and note the 
VSE
 id for it, which is found in the 'self' link. Using the previous example, the 
{vseId}
 is 
j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m
.
Create a Builder Session
Request:
POST /vses/{vseId}/vsBuilderSessions { "name": "test001", "description": "Optional description" }
Response: 
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU" } }, "id": "efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU", "modifyDate": "2016-12-20T14:34:21-06:00", "defaultNonLeafTolerance": "WIDE", "name": "test001", "description": "Optional description", "defaultLeafTolerance": "LOOSE", "version": "2", "createDate": "2016-12-20T14:34:21-06:00" }
The request body should be a JSON object containing a new VS builder session. A successful response returns a JSON object that represents the newly created builder session object. Using the previous example, the 
{sessionId}
 is 
efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU
.
Create a Transport Protocol
Request:
POST /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols { "typeId": "HTTP", "basePath": "/", "useGateway": true, "hostHeaderPassThrough": false, "recordingEndpoint": { "host": "localhost", "port": "8001" }, "targetEndpoint": { "host": "localhost", "port": "8080" } }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU/transportProtocols/bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp" } }, "id": "bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp", "basePath": "/", "asObject": false, "useGateway": true, "hostHeaderPassThrough": false, "allAreStateless": false, "targetEndpoint": { "port": "8080", "host": "localhost" }, "typeId": "HTTP", "desensitize": false, "duptxns": false, "recordingEndpoint": { "port": "8001", "host": "localhost" } }
A successful response returns a JSON containing the new transport protocol. As of Release 10.0, multiple transport protocols can be created but only the first one is used by the recorder. Using the previous example, the 
{tpId}
 is 
bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp
.
Add a Data Protocol (Optional) 
Request:
POST /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols { "forRequest": true, "typeId": "SOAPDPH" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU/transportProtocols/bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp/dataProtocols/efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn" } }, "id": "efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn", "forRequest": true, "typeId": "SOAPDPH" }
This creates a data protocol for a specific builder session and transport protocol.
  • Use SOAPDPH for a Web Services (SOAP) data protocol.
  • Use JSONDPH for a JSON 2.0 data protocol.
  • Use XMLDPH for an XML data protocol.
Using the previous example, the 
{dpId}
 is 
efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn
.
Null Data 
Protocol:
POST /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols
 
{
    
"typeId"
:
"NULLDPH"
}
The null data protocol functions the same as the data protocol.
Adding this to a specified transport protocol prevents content detection (see ).
Add Transactions
  1. Start the recorder
    Request:
POST /vses/{vseId}/recorders { "sessionId": "{sessionId}" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/recorders/bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk" } }, "id": "bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk", "transactionCount": 0, "sessionCount": 0 }
The recorder is now recording. 
Using the example in Create a Transport Protocol, the recorder is listening on http://localhost:8001 (the recording endpoint host and port) and forwarding the requests to http://localhost:8080 (the target endpoint host and port).  Using the previous example, the 
{recorderId}
 is 
bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk
.
2. Open the recording endpoint to record transactions
3, Stop the recorder
Request:
DELETE /vses/{vseId}/recorders/{recorderId}
4. 
Content Detection
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols
If you did not manually add a data protocol to the transport protocol, when the recording is stopped, any DPH detected by content detection during recording is added to the transport protocol. The API specified above can be used to view any data protocols that were detected and added. To disable content detection, see Null Data Protocol
.
 
Manage Transactions
Manage Transactions (Without Data Protocols Applied)
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=15
0. To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Request:
 
DELETE /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Manage Transactions (With Data Protocols Applied)
The following APIs return the same transactions as before (the raw versions) but they have been parsed by the data protocols applied up to and including the data protocol specified by the 
{dpId}
. If you had three data protocols and you specified the id for the second one, the transactions appear with only the first and second data protocols applied.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150. 
To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions/{transactionId}
Create the Virtual Service
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId} Accept: application/zip
Response:
 The response is a ZIP file that contains the virtual service files.
Add Transactions to an Existing Virtual Service Through Recording
Get the VSE Id
Request:
GET /vses
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m" } } }
A successful response returns an array of 
VSE
 Server JSON objects. Choose the 
VSE
 to use and note the 
VSE
 id for it, which is found in the 'self' link. Using the previous example, the 
{vseId}
 is
 j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m
.
Create a Builder Session from a MAR (Existing VS)
Request:
POST /vses/{vseId}/vsBuilderSessions Content-Type: application/zip <Body: MAR file you want to upload>
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU" } }, "id": "efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU", "modifyDate": "2016-12-20T14:34:21-06:00", "defaultNonLeafTolerance": "WIDE", "name": "test001", "description": "Optional description", "defaultLeafTolerance": "LOOSE", "version": "2", "createDate": "2016-12-20T14:34:21-06:00" }
The request should have a VS MAR file with content type set to application/zip. A successful response returns a JSON object that represents the newly created builder session object. Using the previous example, the 
{sessionId}
 is 
efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU
.
View the Transport Protocol or Transport Protocols 
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols 
A successful response returns a JSON containing a list of transport protocols. Using the id property from one of the transport protocols, as the {tpId} for the following API calls.
As of Release 10.0, multiple transport protocols can be created but only the first one is used by the recorder. To add a new data protocol, see Add a Data Protocol (Optional).
View the Data Protocol or Data Protocols (Optional)
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols
A successful response returns a JSON containing a list of data protocols. Using the id property from one of the transport protocols, as the { dpId } for the following API calls.
To add a new data protocol, see Add a Data Protocol (Optional).
Add Transactions
Start the Recorder
Request:
POST /vses/{vseId}/recorders { "sessionId": "{sessionId}" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/recorders/bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk" } }, "id": "bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk", "transactionCount": 0, "sessionCount": 0 }
The recorder is now recording. Using the example in Create a Transport Protocol, the recorder is listening on http://localhost:8001 (the recording endpoint host and port) and forwarding the requests to http://localhost:8080 (the target endpoint host and port). 
Using the example above, the 
{recorderId}
 is 
bgwfXptUuOfsyVfJCRZ67db-5JkJGtaDuAnqDIrXjdLU80dWgk
.
Open the Recording Endpoint to Record Transactions
Stop the Recorder
Request:
DELETE /vses/{vseId}/recorders/{recorderId}
Manage Transactions
Manage Transactions (Without Data Protocols Applied)
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150
 To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Request:
 
DELETE /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Manage Transactions (With Data Protocols Applied)
The following APIs return the same transactions as before (the raw versions) but they have been parsed by the data protocols applied up to and including the data protocol specified by the 
{dpId}
. If you had three data protocols and you specified the id for the second one, the transactions appear with only the first and second data protocols applied.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150. 
To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions/{transactionId}
Create the Virtual Service
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId} Accept: application/zip
Response:
 The response is a ZIP file that contains the virtual service files.
Create a Virtual Service from RR Pairs or a Specification Document (WSDL)
Get the VSE Id
Request:
GET /vses
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m" } } }
A successful response returns an array of 
VSE
 Server JSON objects. Choose the 
VSE
 to use and note the VSE id for it, which is found in the 'self' link. Using the previous example, the 
{vseId}
 is 
j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m
.
Create a Builder Session
Request:
POST /vses/{vseId}/vsBuilderSessions { "name": "test001", "description": "Optional description" }
Response: 
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU" } }, "id": "efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU", "modifyDate": "2016-12-20T14:34:21-06:00", "defaultNonLeafTolerance": "WIDE", "name": "test001", "description": "Optional description", "defaultLeafTolerance": "LOOSE", "version": "2", "createDate": "2016-12-20T14:34:21-06:00" }
The request body should be a JSON object containing a new VS builder session. A successful response returns a JSON object that represents the newly created builder session object. Using the previous example, the 
{sessionId}
 is 
efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU
.
Create a Transport Protocol
Request:
POST /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols { "typeId": "HTTP", "basePath": "/", "useGateway": true, "hostHeaderPassThrough": false, "recordingEndpoint": { "host": "localhost", "port": "8001" }, "targetEndpoint": { "host": "localhost", "port": "8080" } }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU/transportProtocols/bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp" } }, "id": "bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp", "basePath": "/", "asObject": false, "useGateway": true, "hostHeaderPassThrough": false, "allAreStateless": false, "targetEndpoint": { "port": "8080", "host": "localhost" }, "typeId": "HTTP", "desensitize": false, "duptxns": false, "recordingEndpoint": { "port": "8001", "host": "localhost" } }
A successful response returns a JSON containing the new transport protocol. As of Release 10.0, multiple transport protocols can be created but only the first one is used by the recorder. Using the previous example, the 
{tpId}
 is 
bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp
.
Add a Data Protocol (Optional)
Request:
POST /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols { "forRequest": true, "typeId": "SOAPDPH" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU/transportProtocols/bcQqa1IHnc0b_c2g7JkqO-bsAX_6h5sSnYn0VTbLbu8fAggefp/dataProtocols/efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn" } }, "id": "efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn", "forRequest": true, "typeId": "SOAPDPH" }
Creates a data protocol for a specific builder session and transport protocol.
  • Use SOAPDPH for a Web Services (SOAP) data protocol.
  • Use JSONDPH for a JSON 2.0 data protocol.
  • Use XMLDPH for a XML data protocol.
Using the previous example, the 
{dpId}
 is 
efiLyVgPDlffNNXvPXbpdKE6yM1dCuU5qJJPtxrJKCmLAUbYZJn
.
Add transactions
Create a Transaction Bundle
Request:
 
POST /vses/{vseId}/bundles {}
Response: 
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB" } }, "id": "1RKLr1NXz758V7NFvddEBB", "_embedded": { "transactions": [] } }
Using the previous example, the 
{bundleId}
 is 
1RKLr1NXz758V7NFvddEBB.
Create an Input Container
An input container is a server-side container that holds uploaded artifacts (RR pairs and spec documents, for example) until they can be processed to produce transactions.
Request:
 
POST /vses/{vseId}/bundles/{bundleId}/inputContainers {}
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputContainers/IC1Za52IBxr39PIwEUIlBt8m" } }, "id": "IC1Za52IBxr39PIwEUIlBt8m", "_embedded": { "transSources": [] } }
Using the previous example, the 
{inputContainerId}
 is 
IC1Za52IBxr39PIwEUIlBt8m
.
Upload Data to an Input Container
  • Upload RR pair files to an input container.
Request:
POST /vses/{vseId}/bundles/{bundleId}/inputContainers/{inputContainerId}/contents Content-Type: multipart/form-data file1=<the file you want to upload> file2=<the file you want to upload>
Request example (using cURL):
curl -X POST -H "Authorization: Basic XXXXXXXXXXXXX" -H "Content-Type: multipart/form-data;" -F "[email protected]/Applications/CA/DevTest/Projects/Bank v5/Data/rrpair/PayAction-req.txt" -F "[email protected]/Applications/CA/DevTest/Projects/Bank v5/Data/rrpair/PayAction-rsp.txt" "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputContainers/IC1Za52IBxr39PIwEUIlBt8m/contents"
The previous example uses RR pairs defined in the sample Bank v5 Project. The new 
{contentId}
 is the "id" field in the response.
  • Upload a specification document (WSDL) to an input container.
Request:
POST /vses/{vseId}/bundles/{bundleId}/inputContainers/{inputContainerId}/contents Accept: application/zip { "url":"http://localhost:8080/itkoExamples/EJB3UserControlBean?wsdl" }
The previous example requires the 
DevTest
 DemoServer (LISA Bank) to be running. Note the {contentId} in the response.
Process Data Using the Input Processor
An “Input Processor” is responsible for processing the contents of the "Input Container" to produce transactions out of the provided artifacts.
  • Start an input processor.
Request:
POST /vses/{vseId}/bundles/{bundleId}/inputProcessors { "container": "{inputContainerId}" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputProcessors/IPrp57Jc9v2n9P7yimix5I2" } }, "id": "IPrp57Jc9v2n9P7yimix5I2" }
Using the previous example, the 
{processorId}
 is 
IPrp57Jc9v2n9P7yimix5I2
.
  • Check status of an input processor.
Request:
 
GET /vses/{vseId}/bundles/{bundleId}/inputProcessors/{processorId}
  • Stop an input processor (when done).
Request:
DELETE /vses/{vseId}/bundles/{bundleId}/inputProcessors/{processorId}
Manage transactions in the Transaction Bundle
  • Manually add a transaction to a bundle
Request: 
(body properties are base64 encoded!)
POST /vses/{vseId}/bundles/{bundleId}/transactions { "request": { "body": "R0VUIC9pdGtvLWV4YW1wbGVzL3RleHQtcmVzcG9uc2UudHh0IEhUVFAvMS4xDQpBY2NlcHQ6IHRleHQvaHRtbA0KSG9zdDogbG9jYWxob3N0OjgwODANCg==" }, "responses": [ { "body": "SFRUUC8xLjEgMjAwIE9LDQpTZXJ2ZXI6IEFwYWNoZS1Db3lvdGUvMS4xDQpFVGFnOiBXLyIxNzUtMTQ4MzQ2NzYyMjAwMCINClgtUkJULU9wdGltaXplZC1CeTogVVNQTFJCMDEgKFJpT1MgOS4xLjIpIFNDDQpMYXN0LU1vZGlmaWVkOiBUdWUsIDAzIEphbiAyMDE3IDE4OjIwOjIyIEdNVA0KQ29udGVudC1MZW5ndGg6IDE3NQ0KRGF0ZTogVHVlLCAwMyBKYW4gMjAxNyAwMDowMDowMCBHTVQNClgtUG93ZXJlZC1CeTogU2VydmxldCAyLjQ7IEpCb3NzLTQuMi4zLkdBIChidWlsZDogU1ZOVGFnPUpCb3NzXzRfMl8zX0dBIGRhdGU9MjAwODA3MTgxNDM5KS9KQm9zc1dlYi0yLjANCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbg0KDQpUaGlzIGZpbGUgaXMgYW4gZXhhbXBsZSBvZiBhIG5vbi1odG1sIHJlc3BvbnNlIGZpbGUgdG8gdGVzdCBvbi1vZmYgZmVhdHVyZXMgb2YgdGhlIHJlY29yZGVyLg0KDQpUZXN0aW5nIGlzIGEgbWFuZGF0ZSBhbmQgeW91IG5lZWQgdG8gZG8gaXQuICBFdmVyeW9uZSBzaG91bGQgb3duIHF1YWxpdHkuDQoNCkNoZWVycw=="   } ] }
Transaction Request Example (Base64 decoded):
GET /itko-examples/text-response.txt HTTP/1.1 Accept: text/html Host: localhost:8080  
Transaction Response Example (Base64 decoded):
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 ETag: W/"175-1483467622000" X-RBT-Optimized-By: USPLRB01 (RiOS 9.1.2) SC Last-Modified: Tue, 03 Jan 2017 18:20:22 GMT Content-Length: 175 Date: Tue, 03 Jan 2017 00:00:00 GMT X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0 Content-Type: text/plain This file is an example of a non-html response file to test on-off features of the recorder. Testing is a mandate and you need to do it. Everyone should own quality. Cheers
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/1" } }, "id": "1", "_embedded": { "request": { "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/1/request" } } }, "responses": [ { "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/1/responses/2" } }, "id": "2" } ] } }
The "body" fields in the request are required to be 
Base64
 encoded. The response is a JSON that represents the new transaction. Using the previous response, the 
{transactionId}
 is 
1
 in the response.
  • Manage transactions in a bundle.
The following APIs are used to view/delete the transactions that got added in the specific 
{bundleId}
.
Request:
 
GET /vses/{vseId}/bundles/{bundleId}/transactions
Request:
  
GET /vses/{vseId}/bundles/{bundleId}/transactions/{transactionId}
Request:
DELETE /vses/{vseId}/bundles/{bundleId}/transactions/{transactionId}
Process Transactions Using the Bundle Processor
  • Create a bundle processor.
Request
:
POST /vses/{vseId}/bundleProcessors { "sessionId": "{sessionId}", "bundleId": "{bundleId}" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundleProcessors/efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_" } }, "id": "efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_", "status": "IN_PROCESS", "transactionCount": 0, "sessionCount": 0 }
Using the previous example, the 
{procId}
 is 
efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_
.
  • Check the status of the bundle processor. 
Request
:
GET /vses/{vseId}/bundleProcessors/{procId} { "sessionId": "{sessionId}", "bundleId": "{bundleId}" }
  • Delete the bundle processor (when done).
Request
:
DELETE /vses/{vseId}/bundleProcessors/{procId}
Manage Transactions
Manage Transactions (Without Data Protocols Applied)
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions
The response will return the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150. 
To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Request:
 
DELETE /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Manage Transactions (With Data Protocols Applied)
The following APIs return the same transactions as before (the raw versions) but they have been parsed by the data protocols applied up to and including the data protocol specified by the 
{dpId}
. If you had three data protocols and you specified the id for the second one, the transactions will appear with only the first and second data protocols applied.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150. 
To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions/{transactionId}
Create the virtual service
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId} Accept: application/zip
Response:
 The response is a ZIP file that contains the virtual service files. You can deploy the ZIP file directly using the POST method of DCM LISA Invoke REST API.
Add Transactions to an Existing Virtual Service from RR Pairs or a Specification Document (WSDL)
Get the VSE Id
Request:
GET /vses
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m" } } }
A successful response returns an array of 
VSE
 Server JSON objects. Choose the 
VSE
 to use and note the 
VSE
 id for it, which is found in the 'self' link. Using the previous example, the 
{vseId}
 is 
j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m
.
Create a Builder Session from a MAR (Existing VS)
Request:
POST /vses/{vseId}/vsBuilderSessions Content-Type: application/zip <Body: MAR file you want to upload>
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/vsBuilderSessions/efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU" } }, "id": "efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU", "modifyDate": "2016-12-20T14:34:21-06:00", "defaultNonLeafTolerance": "WIDE", "name": "test001", "description": "Optional description", "defaultLeafTolerance": "LOOSE", "version": "2", "createDate": "2016-12-20T14:34:21-06:00" }
The request should have a VS MAR file with content type set to application/zip. A successful response returns a JSON object that represents the newly created builder session object. Using the previous example, the 
{sessionId}
 is 
efrsjq_mqVTNwXYsmQ9vxE1dYTwWNy07FD8ioKuZmVNugsgWHAU
.
View the Transport Protocol or Transport Protocols 
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols 
A successful response returns a JSON containing a list of transport protocols. Using the id property from one of the transport protocols, as the {tpId} for the following API calls.
As of Release 10.0, multiple transport protocols can be created but only the first one is used by the recorder. To add a new data protocol, see Add a Data Protocol.
View the Data Protocol or Data Protocols (Optional)
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols
A successful response returns a JSON containing a list of data protocols. Using the id property from one of the transport protocols, as the { dpId } for the following API calls.
To add a new data protocol, see  Add a Data Protocol.
Add Transactions
Create a Transaction Bundle
Request:
POST /vses/{vseId}/bundles {}
Response: 
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB" } }, "id": "1RKLr1NXz758V7NFvddEBB", "_embedded": { "transactions": [] } }
Using the previous example, the 
{bundleId}
 is 
1RKLr1NXz758V7NFvddEBB
.
Create an Input Container
An "Input Container" is a server-side container that holds uploaded artifacts (RR pairs and spec documents, for example) until they can be processed to produce transactions.
Request:
 
POST /vses/{vseId}/bundles/{bundleId}/inputContainers {}
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputContainers/IC1Za52IBxr39PIwEUIlBt8m" } }, "id": "IC1Za52IBxr39PIwEUIlBt8m", "_embedded": { "transSources": [] } }
Using the previous example, the 
{inputContainerId}
 is 
IC1Za52IBxr39PIwEUIlBt8m.
Upload Data to an Input Container
  • Upload RR Pair files to an input container.
Request:
 
POST /vses/{vseId}/bundles/{bundleId}/inputContainers/{inputContainerId}/contents Content-Type: multipart/form-data file1=<the file you want to upload> file2=<the file you want to upload>
Request example
 (using cURL):
curl -X POST -H "Authorization: Basic XXXXXXXXXXXXX" -H "Content-Type: multipart/form-data;" -F "[email protected]/Applications/CA/DevTest/Projects/Bank v5/Data/rrpair/PayAction-req.txt" -F "[email protected]/Applications/CA/DevTest/Projects/Bank v5/Data/rrpair/PayAction-rsp.txt" "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputContainers/IC1Za52IBxr39PIwEUIlBt8m/contents"
The previous example uses RR pairs defined in the sample Bank v5 Project. The new 
{contentId}
 is the "id" field in the response.
  • Upload a specification document (WSDL) to an input container.
Request:
POST /vses/{vseId}/bundles/{bundleId}/inputContainers/{inputContainerId}/contents Accept: application/zip { "url":"http://localhost:8080/itkoExamples/EJB3UserControlBean?wsdl" }
The previous example requires the 
DevTest
 DemoServer (LISA Bank) to be running. Note the {contentId} in the response.
Process Data Using the Input Processor
An “Input Processor” is responsible for processing the contents of the "Input Container" to produce transactions out of the provided artifacts.
1. Start an input processor.
Request:
POST /vses/{vseId}/bundles/{bundleId}/inputProcessors { "container": "{inputContainerId}" }
 
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/inputProcessors/IPrp57Jc9v2n9P7yimix5I2" } }, "id": "IPrp57Jc9v2n9P7yimix5I2" }
Using the previous example, the 
{processorId}
 is 
IPrp57Jc9v2n9P7yimix5I2
.
2. Check the status of an input processor.
Request:
GET /vses/{vseId}/bundles/{bundleId}/inputProcessors/{processorId}
3. Stop an input processor (when done).
Request:
DELETE /vses/{vseId}/bundles/{bundleId}/inputProcessors/{processorId}
Manage Transactions in the Transaction Bundle
  • Manually add a transaction to a bundle 
Request: 
(body properties are base64 encoded!)
POST /vses/{vseId}/bundles/{bundleId}/transactions { "request": { "body": "R0VUIC9pdGtvLWV4YW1wbGVzL3RleHQtcmVzcG9uc2UudHh0IEhUVFAvMS4xDQpBY2NlcHQ6IHRleHQvaHRtbA0KSG9zdDogbG9jYWxob3N0OjgwODANCg==" }, "responses": [ { "body": "SFRUUC8xLjEgMjAwIE9LDQpTZXJ2ZXI6IEFwYWNoZS1Db3lvdGUvMS4xDQpFVGFnOiBXLyIxNzUtMTQ4MzQ2NzYyMjAwMCINClgtUkJULU9wdGltaXplZC1CeTogVVNQTFJCMDEgKFJpT1MgOS4xLjIpIFNDDQpMYXN0LU1vZGlmaWVkOiBUdWUsIDAzIEphbiAyMDE3IDE4OjIwOjIyIEdNVA0KQ29udGVudC1MZW5ndGg6IDE3NQ0KRGF0ZTogVHVlLCAwMyBKYW4gMjAxNyAwMDowMDowMCBHTVQNClgtUG93ZXJlZC1CeTogU2VydmxldCAyLjQ7IEpCb3NzLTQuMi4zLkdBIChidWlsZDogU1ZOVGFnPUpCb3NzXzRfMl8zX0dBIGRhdGU9MjAwODA3MTgxNDM5KS9KQm9zc1dlYi0yLjANCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbg0KDQpUaGlzIGZpbGUgaXMgYW4gZXhhbXBsZSBvZiBhIG5vbi1odG1sIHJlc3BvbnNlIGZpbGUgdG8gdGVzdCBvbi1vZmYgZmVhdHVyZXMgb2YgdGhlIHJlY29yZGVyLg0KDQpUZXN0aW5nIGlzIGEgbWFuZGF0ZSBhbmQgeW91IG5lZWQgdG8gZG8gaXQuICBFdmVyeW9uZSBzaG91bGQgb3duIHF1YWxpdHkuDQoNCkNoZWVycw=="   } ] }
Transaction Request Example (Base64 decoded):
GET /itko-examples/text-response.txt HTTP/1.1 Accept: text/html Host: localhost:8080  
Transaction Response Example (Base64 decoded):
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 ETag: W/"175-1483467622000" X-RBT-Optimized-By: USPLRB01 (RiOS 9.1.2) SC Last-Modified: Tue, 03 Jan 2017 18:20:22 GMT Content-Length: 175 Date: Tue, 03 Jan 2017 00:00:00 GMT X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0 Content-Type: text/plain This file is an example of a non-html response file to test on-off features of the recorder. Testing is a mandate and you need to do it. Everyone should own quality. Cheers
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/3" } }, "id": "3", "_embedded": { "request": { "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/3/request" } } }, "responses": [ { "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundles/1RKLr1NXz758V7NFvddEBB/transactions/3/responses/4" } }, "id": "4" } ] } }
The "body" fields in the request are required to be 
Base64
 encoded. The response is a JSON that represents the new transaction. Using the previous response, the 
{transactionId}
 is 
3
 in the response.
  • Manage transactions in a bundle
The following APIs are used to view/delete the transactions that got added in the specific 
{bundleId}
.
Request:
GET /vses/{vseId}/bundles/{bundleId}/transactions
Request:
 
GET /vses/{vseId}/bundles/{bundleId}/transactions/{transactionId}
Request:
DELETE /vses/{vseId}/bundles/{bundleId}/transactions/{transactionId}
Process Transactions Using the Bundle Processor
1. Create a bundle processor.
Request
:
POST /vses/{vseId}/bundleProcessors { "sessionId": "{sessionId}", "bundleId": "{bundleId}" }
Response:
{ "_links": { "self": { "href": "http://localhost:1505/lisa-virtualize-invoke/api/v2/vses/j4xHDBZf8x3-9Hmsv25utXt2HZjEoNlliAx3LVkNoBDN4VxvYo-m/bundleProcessors/efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_" } }, "id": "efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_", "status": "IN_PROCESS", "transactionCount": 0, "sessionCount": 0 }
Using the previous example, the 
{procId}
 is 
efruRJNtipG52v3f9kcg3opLePFUSDwDk5TQNSn3ediVbiwfjl_
.
2. Check the status of the bundle processor.
Request
:
GET /vses/{vseId}/bundleProcessors/{procId} { "sessionId": "{sessionId}", "bundleId": "{bundleId}" }
3. Delete the bundle processor (when done).
Request
:
DELETE /vses/{vseId}/bundleProcessors/{procId}
Manage Transactions
Manage Transactions (Without Data Protocols Applied)  
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: 
?offset=0&limit=150
 To manage a specific transaction, note the unique transaction id for each transaction.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Request:
 
DELETE /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/transactions/{transactionId}
Manage Transactions (With Data Protocols Applied)
The following APIs return the same transactions as before (the raw versions) but they have been parsed by the data protocols applied up to and including the data protocol specified by the 
{dpId}
. If you had three data protocols and you specified the id for the second one, the transactions appear with only the first and second data protocols applied.
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions
The response returns the first 100 transactions by default. You can add offset and limit parameters to the URL to get more transactions at a time or to do paging. For example: ?offset=0&limit=150 To manage a specific transaction, note the unique transaction id for each transaction.
Request:
 
GET /vses/{vseId}/vsBuilderSessions/{sessionId}/transportProtocols/{tpId}/dataProtocols/{dpId}/transactions/{transactionId}
Create the Virtual Service 
Request:
GET /vses/{vseId}/vsBuilderSessions/{sessionId} Accept: application/zip
Response:
 The response is a ZIP file that contains the virtual service files.
Export a Virtual Service as MAR File
Get the VSE Id
Request:
GET /vses
Response:
{
    "_links": {
        "self": {
        }
    }
}
A successful response returns an array of VSE Server JSON objects. Choose the VSE to use and note the VSE id for it, which is found in the 'self' link.
Using the previous example, the
 {vseId} 
is:
 j4xHDBZgbtMPZDxayNeJ8GFwswOqP1FnQHQlJcHypYULzoitnnFP
Get the Service Id
Request:
GET /vses/{vseId}/services
Response:
{
  "_links": {
    "self": {
    }
  },
  "count": 2,
  "total": 2,
  "_embedded": {
    "services": [
      {
        "_links": {
          "self": {
          }
        },
        "serviceId": "hM0SMHGOzxuf",
        "serviceName": "kioskV6"
      },
      {
        "_links": {
          "self": {
          }
        },
        "serviceId": "hM0SMHGOzxue",
        "serviceName": "kioskV5"
      }
    ]
  }
}
A successful response returns an array of Virtual Service JSON objects. Choose the Virtual Service to use and note the service id for it, which is found in the 'services' link. 
Using the previous example, the
 {serviceId} 
is: 
 hM0SMHGOzxuf and hM0SMHGOzxue
Download MAR file
The following instructions assume that you are using the Postman REST client.
GET /vses/{vseId}/services/{serviceId}
Response:
{
  "_links": {
    "self": {
    }
  },
  "serviceId": "hM0SMHGOzxue",
  "serviceName": "kioskV5",
  "modelName": "kioskV5",
  "capacity": 1,
  "txnPerSecond": 0,
  "txnCount": 0,
  "peakTxnPerSecond": 0,
  "thinkScale": 100,
  "errorCount": 0,
  "autoRestartEnabled": true,
  "status": 2,
  "statusDescription": "running",
  "startTime": "8/24/17 3:00:46 PM",
  "startTimeLong": 1503579646141,
  "endTime": "",
  "endTimeLong": 0,
  "upTime": 4016773,
  "executionMode": "Most Efficient",
  "executionModeValue": "EFFICIENT",
  "configurationName": "project.config",
  "resourceName": "8001 : http :  : /itkoExamples",
  "groupTag": ""
}
A successful response returns a Virtual Service JSON object.
To download the MAR file follow these steps:
  1. Copy the Request URL into Postman.
  2. Configure ‘Basic Authorization’ and add the ‘Accept’ header with the value: 
    application/zip
    See the screenshot below:
    manually add mar file.png
  3. Click the 
    Send
     and 
    Download 
    button.
  4. Manually add the .mar extension after the file name. 
  5. Save the MAR file.
Important: 
The link provided for the MAR file download in ‘Service Virtualization API v2’ UI does not work due to Swagger limitations. The corrupted download link in Swagger UI is documented here: https://github.com/swagger-api/swagger-ui/issues/374