REST Service – Source Reference


 The Rest Service element is used to make REST requests. The output of the response body can be referenced by subsequent elements.

Syntax

<RestService id="<id>"
label=”<label>
 endpointUri="<REST Service URI>"
         httpType="<Request Type>"
 decription=”<description>
 statusCodeVerify="<HTTP status code verify>">
<Authentication type="Basic" userId="<userid>" />
<HttpHeaders>
             <Header key="<headername>" value="<value>" />
    </HttpHeaders>
        <UrlParameters>
              <Parameter key="<paramtername>" value="<value>" />
        </UrlParameters>
    <Request><![CDATA[<REQUEST BODY DATA>]]></Request>
<ResponseVerify><![CDATA[<RESPONSE VERIFY DATA>]]></ResponseVerify>
</RestService>

Required fields

id – A unique name used to refer to output from this element.

endpointUri – The URI of the REST service

httpType – The type of HTTP request. Must be POST, GET, PUT or DELETE

statusCodeVerify – A single value such as 200 or a JavaScript expression like value >=200 && value<300. The word ‘value’ represents the HTTP status code returned from the HTTP request.

Example

To get the connections from the Total Test Repository Server.

<RestService id="ServerConnections"
endpointUri="http://xatesterwin:48228/totaltestapi/connection/"
httpType="GET"
statusCodeVerify="value&gt;=200 &amp;&amp; value&lt;300" />

 

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