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.
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.
Specify URL
The URL of a REST request consists of several parts that you specify in the Request toolbar:
-
Endpoint - the address of a RESTful service. It contains a protocol (usually,
http
orhttps
), 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:
In the editor, you can:
-
Add or remove parameters.
-
Change the parameter type.
-
Configure the advanced options.
-
Modify parameter values.
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:
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):
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. |
Recreates a message by using the sample body content specified in the definition or a representation. |
|
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 |
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.
Simulate HTML forms
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:
-
Set a POST or PUT method for a request.
-
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.
-
-
Enable the Post QueryString check box.
This will make ReadyAPI send parameters in the message body. -
Click Send.