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

  1. Select the Route Option: In the Route Options drop-down, select Route and Record for Conditional Match.

    Route Options drop-down with "Route and Record for Conditional Match" selected in the service editor
  2. Add a Route: Specify the live API endpoint (a petstore API) in the Route To field.

    Route To field populated with the target API endpoint in the service editor
  3. Send a Request: Once you have configured the routing, send a request to the virtual service.

    Request sent to the virtual service using the configured Route and Record for Conditional Match option
  4. 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.

    Service editor showing a newly created virtual operation
  5. Signature, Conditional Match, and Response Creation: The service creates a Signature, Conditional Match, and Response.

    Service editor displaying the created Signature, Conditional Match rule, and recorded Response for a new virtual operation

    ReadyAPI automatically sets parameter types and sets all conditions to Equals.

    Screenshot of ReadyAPI showing parameters with automatically set types and 'equals' conditions
  6. 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.

    Service editor showing multiple recorded requests added to an existing virtual operation for the same resource
  7. Optional: Disable Response Recording: You can choose to stop recording responses by deselecting the Record Response option if needed.

    The Record Responses checkbox is deselected to stop recording responses

Additional Notes

  • This route option supports all HTTP methods, including GET, PUT, POST, and DELETE. However, the system might not record matches for GET 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.

See Also

Publication date: