Updated on 2024-11-13 GMT+08:00

Obtaining an Array via Reverse Index

Function Name

$getReverseItem(StringA, intB)

Parameter Description

  • StringA: array or list element path of the response body or response header.
  • intB: subscript of the array in reverse order. 0 indicates the last array, and 2 indicates the last but one array.

Function Description

Obtains an array from a response body or header based on the reverse index.

Application Scenarios

The built-in function for obtaining arrays during response extraction based on the reverse index can be used for API automation.

Example

As shown in the following figure, the property value of the response body parameter item is the function for obtaining arrays via reverse Index. Parameter A in the function is the response body property result, and parameter B is 0.