Introduction
ReadyAPI helps Agile and DevOps development teams improve API quality by allowing them to manage and run automated functional, security, and performance tests through a single centralized interface. ReadyAPI empowers software teams to share testing projects and artifacts, report and fix errors straight from the testing IDE, and distribute licenses among team members.
This blog explains the details of Data Sources in Virtual Services in Ready API along with the details of Property Expansion, Configure Data Sources in Virtual Services, and References to Data in Responses.
Without further ado, let's get started.

Property Expansion in Responses
You can add property values from your Project, virtual service, or data source to the response contents in ReadyAPI:
-
Your Project's or virtual service's custom properties (those that are displayed on the Custom Properties tab at the bottom of the Navigator panel) can be included.
-
Any characteristic of a data source you connected to a response.
The virtual service increases the properties and swaps out their references with actual property values before responding to a client.
Let's look into the details of Project and Service properties.
Project and Service Properties
The following syntax should be used to refer to a property:
Syntax:
${#MockService#property-name}
Use this syntax to refer to a project property:
Syntax:
${#Project#property-name}
Simply provide the reference expression in the response properties' Edit box.
Using the Get Data command from the context menu is a simple approach to adding a property reference: set the insertion point in the Edit box's desired location, then use the context menu to right-click and choose Get Data > property-name.
Use code similar to this to refer to service and project properties in scripts:
Code:
def propertyValue = requestContext.mockService.getPropertyValue('your-property-name')
//Project custom property
def propertyValue2 = requestContext.mockService.project.getProperty('your-property-name').getValue();
Let's look into the details of Data Source properties.
Data Source Properties
Use the following syntax to make a reference to a data source property:
Syntax:
${#MockResponse#datasource-property-name}
Use the following code to refer to these properties from the script:
Code:
def propertyValue = mockResponse.getPropertyValue('datasource-property-name')
The Get Data command does not allow the insertion of data source properties.
To expand these characteristics, you must specify the data source in the response's Data Source field for a virtual service.
Lets dive into the details of Configuring Data Sources in Virtual Services.