REST Requests

Applies to ReadyAPI 3.51, last modified on March 21, 2024

You use REST requests to test RESTful services.

In this topic, you will learn how to configure a REST request. After you send the request to a service, ReadyAPI shows you a response in the Response panel. To learn about it, see Request Editor Interface.

REST request editor overview

Click the image to enlarge it.

To open the REST Request editor:

  • Select the desired request in the Navigator panel.

— or —

  • Click API Request when editing a related REST Request test step.

    Show image

Specify URL

The URL of a REST request consists of several parts that you specify in the Request toolbar:

REST testing in ReadyAPI: Specify URL

Click the image to enlarge it.

  • Endpoint - the address of a RESTful service. It contains a protocol (usually, http or https), a host, and a port in the following format:

    <protocol>://<host>:<port>

    The host cannot contain underscores.
  • Resource - the path to a resource of a RESTful service to which you send a request. To specify a variable part of the resource path, use the TEMPLATE parameter.

  • Parameters - a query string containing specified QUERY parameters and their values. Use Parameter editor to specify them.

Configure parameters

You modify and configure request parameters in the Parameter editor:

The Parameter editor

Click the image to enlarge it.

In the editor, you can:

To learn how to do this, see Working with parameters.

Tip: Once you configure the needed parameters, you can use the Form panel to change only the parameters' value with the fields related to the xsd type, specified for the parameter. For example, you can use a date picker for the date parameters, or a drop-down list for parameters with the specified selection list.

Change request method

To change the request’s method, use the drop-down list on the request editor toolbar:

Configire REST request: Change request’s method

Click the image to enlarge it.

Specify request body

If a request uses an HTTP method that sends the request body (for example POST or PUT), ReadyAPI shows the Content editor to configure the request body (payload):

Configure REST request: Request body

Click the image to enlarge it.

The editor has a toolbar with the following commands:

Command Description

Media Type

The media type of the request body. You can select one of the values from the drop-down list or enter your own value.

Recreate

Recreates a message by using the sample body content specified in the definition or a representation.
ReadyAPI uses the request or an XML Schema definition for the application/xml media type, and the representation for other requests. If neither is available, the button is disabled.

Post QueryString

If selected, the request puts a query string to the message body, instead of the URL. The media type in this case, is set to application/x-www-form-urlencoded.

Example

Tips:

  • You can insert variable parts in the request body. For example, properties specified in a project, test suite, or a test case. In functional tests, you can insert data extracted from a data source or a previous test step. To do this, use the property expansion: right-click within the content editor and select Get Data.

  • If the request body contains XML or JSON data, you may use the Outline or Form panel to modify element values in the tree-like representation of the body.

To emulate sending HTML form, you need to send a POST or PUT request, which parameters passes the needed values to the server. To do this:

REST testing in ReadyAPI: Simulate HTML form

Click the image to enlarge it.

  1. Set a POST or PUT method for a request.

  2. Add a number of parameters to the request. Each parameter represents a form field:

    • The parameter name must be equal to the name argument of the input field it represents.

    • The parameter value is a value you would specified in the field.

    • Set the parameter type to QUERY.

  3. Enable the Post QueryString check box.
    This will make ReadyAPI send parameters in the message body.

  4. Click Send.

If you want to import the message body from a file:

The Attachments editor

Click the image to enlarge it.

  1. Leave the Content editor empty.

  2. Add a single attachment with the same media-type as the message.

This will insert the file content into the message body instead of attaching it as a MIME attachment.

Related Tasks

See Also

Configuring Requests
REST Request Test Step

Highlight search results