Optional Fields
Some fields in a request payload are not required for the API to process your request successfully. These are optional fields.
When a field is optional and you have no value to send, you have two ways to handle it:
Pass
nullas the value.Exclude the field entirely from the payload. /
Either approach is accepted, the API does not require optional fields to be present.
Example
If middleName is an optional field, both of these payloads are valid:
// Option 1: explicit null
{
"firstName": "Ada",
"middleName": null,
"lastName": "Obi"
}json
// Option 2: field excluded
{
"firstName": "Ada",
"lastName": "Obi"
}Last updated