get, request, body, item, api, request, response, send, soap, rest, get, post, put, delete

Method GetRequestBodyItem

API

Gets Request Body Item value

Watch this video to learn how to use this method

Have a problem with playback?
GetRequestBodyItem returns request body item value The input parameter is string Name and optional Position if request contains more then one body item with similar name. It is starting from 0 and 0 by default The output is string Value Let's see ConcatArrayData Request Body contains 2 items with the same name Let's output 2nd one via messagebox So the name should be "array.a:string" and the number shoild be "1" We can see output is "b" as expected.

Usage

Function GetRequestBodyItem(
    String Name,
    Integer Position [Optional],
    Boolean Report [Optional]
)

CreateBook

ZAP API Method step

GetReq...dyItem

Title

0

True

title

Name

Position [Optional]

Report

Output Parameter

Parameters

Name

Type: String

The name of the Body Item

Position (optional)

Type: Integer

Default Value: 0

Position if request contains few item names

Report (optional)

Type: Boolean

Default Value: False

Generate report for this step

Returns

Request Body Item value or Empty string

Example

VBScript

msgbox Server("API Server").Method("CreateBook").GetRequestBodyItem("Title")
' set position and add to report result
msgbox Server("API Server").Method("CreateBook").GetRequestBodyItem("Title", 0, True)

JavaScript

alert(Server("API Server").Method("CreateBook").GetRequestBodyItem("Title"));
// set position and add to report result
alert(Server("API Server").Method("CreateBook").GetRequestBodyItem("Title", 0, true));

CreateBook

ZAP API Method step

GetReq...dyItem

Title

0

True

title

Script-Less next step

Method

ZAP Utility step

Zap.Comm...Box

Zap.Var...("title")

Contact Us

3150 Roswell Rd NW

Atlanta, GA, 30305, USA

(800) 795-3552