getIndex #

Available since 2.11.0

Returns the index specified in the request.

Arguments #

getIndex (options: { required?: boolean } = {}): string

Options:

NameTypeDescriptionDefault
required
boolean
If true, throws an api.assert.missing_argument error when the index is missing. If false, returns null insteadtrue

Example #

const index = request.getIndex();
// equivalent
const index = request.input.args.index;
//+ checks to make sure that "index" is of the right type
// and throw standard API error when it's not the case

// returns null if no index is provided
const index = request.getIndex({ required: false });