REST Service


The Rest Service element is used to call a REST based web service.

Add Rest Service to the test scenario by dragging it from the tool palette. It opens the Insert a new Rest Service element dialog box. Following are the fields available when setting up this element:

  • ID - A unique name used to refer to output from this element by other elements in this test scenario. Reference to this ID by using the format ${myid}.
  • Label - This is the label name you want assigned.
  • Description - An optional description of the Test Element.
  • Endpoint URI - Required, contain the type of REST request and URI of the REST service. The request type drop-down specifies the type of REST request. This can be POST, GET, PUT or DELETE. The text field is required and contains the URI of the REST service.

Request Body tab

 The request body is used to send data to the specified REST service. Enter the data required by the REST service.

Request Parameters tab

 Any request parameters required by the REST service can be entered here.

To add a request parameter:

  1. Click the ‘Add’ button to add a request parameter.
  2. In the ‘Parameter name’ column entered the name of request parameter.
  3. In the ‘Value’ column entered the value for the request parameter.

To delete a request parameter:

Click the ‘Delete’ button to remove a request parameter.

Request Headers tab

 Any request parameters required by the REST service can be entered here.

To add a request header

  1.  Click the ‘Add’ button to add a request header.
  2. In the ‘Header name’ column entered the name of request header.
  3. ‘In the ‘Value’ column entered the value for the request header.

To delete a request header

Click the ‘Delete’ button to remove a request header.

On Authorization tab

The authorization tab allows you to specify the type of authorization required by the REST service. Currently only No authorization or Basic authorization is supported.

Authorization Type - To use no authorization, select the ‘No Authorization’ button. To use basic authorization, select the ‘Basic authorization’ button.

User ID - When basic authorization is selected the ID of the user to be authenticated must be specified.

On Verify Tab

The verify tab allows you to verify the results of the REST request.

Verify HTTP Status code – This field can be used to verify the HTTP return code. It can either be an expected fixed value (for example, 200) or a JavaScript expression (for example, value >=200 && value<300). The word ‘value’ represents the HTTP status code returned from the HTTP request.

Expected response data – This field can be used to verify the content of the request body. The content of this field much match exactly to the response data.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI DevX Workbench for Eclipse 23.02