Check how functions work

POST https://{{host}}/test-management/v3/functional/functions/try-it

Runs a created function on sample data to check whether it returns the expected value. A function is valid for use in a test case if the response's results value returns only one value. To learn more about functions and variables, see Variables.

Request Params

KeyDatatypeRequiredDescription
accountSwitchKeystring(Optional) For customers who manage more than one account, this runs the operation from another account. The Identity and Access Management API provides a list of available account switch keys.

Request Body

{"functionExpression"=>"fn_getResponseHeaderValue(Server)", "responseData"=>{"response"=>{"headers"=>[{"name"=>"Server", "value"=>"Apache/2.2.15 (CentOS)"}, {"name"=>"Content-Type", "value"=>"text/html; charset=utf-8"}, {"name"=>"Content-Encoding", "value"=>"gzip"}, {"name"=>"Cache-Control", "value"=>"no-cache, no-store"}, {"name"=>"Date", "value"=>"Tue, 14 Mar 2023 16:30:14 GMT"}, {"name"=>"Content-Length", "value"=>"37120"}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"Set-Cookie", "value"=>"id=abc; path=/; Secure;domain=example.com"}, {"name"=>"Set-Cookie", "value"=>"theme=light"}, {"name"=>"Set-Cookie", "value"=>"sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"}], "httpVersion"=>"HTTP/1.1", "status"=>200, "statusText"=>"OK"}}, "variables"=>[{"variableName"=>"var1", "variableValue"=>"name"}]}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{"functionExpression":"fn_getResponseHeaderValue(Server)","responseData":{"response":{"cookies":[],"headers":[{"name":"Server","value":"Apache/2.2.15 (CentOS)"},{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Encoding","value":"gzip"},{"name":"Cache-Control","value":"no-cache, no-store"},{"name":"Date","value":"Tue, 14 Mar 2023 16:30:14 GMT"},{"name":"Content-Length","value":"37120"},{"name":"Vary","value":"Accept-Encoding"},{"name":"Set-Cookie","value":"id=abc; path=/; Secure;domain=example.com"},{"name":"Set-Cookie","value":"theme=light"},{"name":"Set-Cookie","value":"sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"}],"httpVersion":"HTTP/1.1","status":200,"statusText":"OK"}},"result":"Apache/2.2.15 (CentOS)"}