Route and Record for Conditional Match
Overview
The virtual service routes all incoming requests and automatically creates virtual operations for any requests that don’t already have existing operations. It records both the request and response data while generating the corresponding Conditional Match and Signature to accurately handle future requests.
Configure Route and Record for Conditional Match
Select the Route Option: In the Route Options drop-down, select Route and Record for Conditional Match.
Add a Route: Specify the live API endpoint (a petstore API) in the Route To field.
Send a Request: Once you have configured the routing, send a request to the virtual service.
Automatic Operation Creation: If the virtual operation does not already exist, the virtual service creates a new virtual operation based on the request’s specific resource.
Signature, Conditional Match, and Response Creation: The service creates a Signature, Conditional Match, and Response.
ReadyAPI automatically sets parameter types and sets all conditions to
Equals
.Handling Subsequent Requests: Future requests to the same Virtual Action update the existing operation rather than creating a new one. This ensures efficient reuse and accurate response selection.
Tip
By default, future requests to the same resource update the existing virtual operation and merge their responses. To capture a separate response for each unique Conditional Match request, add a VM option to disable response merging.
Optional: Disable Response Recording: You can choose to stop recording responses by deselecting the Record Response option if needed.
Additional Notes
This route option supports all HTTP methods, including
GET
,PUT
,POST
, andDELETE
. However, the system might not record matches forGET
requests because they usually do not include a body.To include magic strings in recorded responses, go to Settings, click Virtual Service, and then select both the Enable conditional match property expansion and Enable conditional match dates property expansion. Recorded responses automatically include magic strings for dynamic matching.
To exclude headers from the recorded responses, go to Settings, click Virtual Service, and then in the Import Settings section, select Ignore Headers. This also applies to other route options, giving you finer control over the imported data.
If you record requests without a body, the virtual service creates only one response and one conditional match. You cannot define conditions based on body content in this case.
You can use external API clients to send requests through this route option. ReadyAPI records and virtualizes the incoming traffic as expected.