Core
Framework v2.x
2

getBodyObject #

Available since 2.16.9

Gets a parameter from the request body and checks that it is an object. We also support lodash syntax. (relations.lebron[0])

Arguments #

Copied to clipboard!
getBodyObject (name: string, def: JSONObject = null): JSONObject

Name Type Description
name
string
Parameter name
def
JSONObject
Default value to return if the parameter is not set

Example #

Copied to clipboard!
const metadata = request.getBodyObject('metadata');
// equivalent
const metadata = request.input.body.metadata;
//+ checks to make sure that "metadata" is of the right type
// and throw standard API error when it's not the case