Property Expansion in Responses

Applies to ReadyAPI 3.54, last modified on July 23, 2024

In ReadyAPI, you can include property values of your project, virtual service or data source in response contents:

  • You can include custom properties of your project or virtual service (that is, the properties that you can see on the Custom Properties page at the bottom of the Navigator panel), or

  • Any property of a data source that you associated with a response.

You specify properties by their names (see below). Before sending a response to a client, the virtual service expands the properties and replaces their references with actual property values.

Project and Service Properties

To refer to a property, use the following syntax:


To refer to a project property, use the following syntax:


Just type the reference expression to the Edit box in response properties.

An easy way to insert a property reference is to use the Get Data command of the context menu: place the insertion point into the desired place within the Edit box, right-click and select Get Data > property-name from the context menu:

Service virtualization and API testing: The Get Data command

Click the image to enlarge it.

To refer to service and project properties in scripts, use code like this:


// Service custom property
def propertyValue = requestContext.mockService.getPropertyValue('your-property-name')

// Project custom property
def propertyValue2 = requestContext.mockService.project.getProperty('your-property-name').getValue();

Data Source Properties

To refer to a data source property, use the following syntax:


To refer to these properties from script, use code like this:


def propertyValue = mockResponse.getPropertyValue('datasource-property-name')

Data source properties cannot be inserted with the Get Data command.

In order for a virtual service to expand these properties in a response, you need to specify the data source in the response’s Data Source property. See Data Sources in Virtual Services for complete information.

See Also

Configuring Virtual Services
Data Sources in Virtual Services
Property Expansion
Preparing Virtual Service Before Deploying to VirtServer

Highlight search results