There are several ways to set default values for the content added by the insert API.
Please implement the desired method by referring to the methods for the frontend, preprocessing, and triggers.
In this FAQ, we assume the code for the Member::insert endpoint.
Setting default values for Member::insert
Implementing on the frontend
For example, let's say the "Don't subscribe to notifications" for a member is registered with the default value (unchecked state) by default.
When sending a request from the frontend, if you implement it to include
"email_send_ng_flg": false in the request, you can register a member with the "Don't subscribe to notifications" unchecked.
"email_send_ng_flg": false to the request without showing it to the user, as shown below.
For example, if a numeric value is set for an extended item of a member, it will be registered as blank if no value is specified in the request via the API.
If there are multiple extended items of numeric value type and you want to set 0 as the default value for all of them, you can write a custom preprocessing and set it as a preprocessing step.
By setting it in Pre-processing, you can set default values for each endpoint.
Setting a Trigger
You can also set default values for multiple numeric value type extended items using a trigger.
The trigger uses "Before Member Registration".
The variable name used in custom processing is slightly different from the pre-processing pattern.
By setting it with a trigger, you can set default values for all members registered through the API.