REST Response Properties

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

To view or change properties and contents of virtual responses, select a response in the Outgoing column of the Setup page of the virtual service editor. You will see the properties on the right of the ReadyAPI window:

Service virtualization and API testing: Properties of outgoing messages (responses)

Click the image to enlarge it.

Properties of REST responses are organized into the following categories.

Edit

Property Description
Http Status Code

The response status line and code.

Note: When validating virtual service responses, ReadyAPI does not treat “error” codes like 404 or 406 as errors. These codes can be expected by your test procedure. To verify whether a service functions properly, use assertions on the client side.
Content | Media type Specifies the data type of the response body.
Editor and
Outline

The Editor box contains the response body data. You can include custom properties of your virtual service, as well as data source properties, into the response. To do this, use syntax like this:

${#MockService#Virt-Property-Name}

${#MockResponse#Response-Property-Name}

${DataSource-Property-Name}

See Property Expansion in Responses and Data Sources in Virtual Services for complete information.

The Outline view is available if the Editor contains XML data.

Script

A Groovy script code that the virtual service runs before sending the response to the client. You can use this code, for example, to change the response contents or for debug purposes. For information on scripting and available objects, see Virtual Service Scripting.

Note that methods and properties of the mockResponse object modify the response body that you have in the Editor box.

Headers

A list of custom response headers. The toolbar above the list contains commands for creating and deleting headers, changing their order, sorting, clearing header values, and loading header values from and saving them to a file.

In custom headers, you can mention custom properties of your service and data source properties, for example:

REST service virtualization and API testing: Custom response headers

See Property Expansion in Responses.

Data Source

Specifies the data source, whose properties you can use in the response body and headers. See Data Sources in Virtual Services.

If the response body contains a JSON object, you can create data source properties from the object properties. To do this, simply click .

See Also

Reference

Highlight search results