RESTAPIRequestBody - nextEntry()

Retrieve one entry from the request body as a script object.

Use this method with the hasNext() method to iterate over multiple request body entries.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Object A single entry from the request body.

var requestBody = request.body;
var requestEntry = requestBody.nextEntry(); // returns available entry if there is only one entry, or the first entry if there are multiple.
var name = requestEntry.name; // ‘user1’

// Calling second time
requestEntry = requestBody.nextEntry(); // returns undefined if there is only one entry, or the second entry if there are multiple.

This example demonstrates using hasNext() with nextEntry().

var requestBody = request.body;
while(requestBody.hasNext()){
var entry = requestBody.nextEntry();
}