I think I can use API only once the installation is over with full network services set up.
I'm pretty sure the API is up by default after firstboot. You don't need to set up any additional services, as far as I know. (I don't actually use the API though so this is secondhand data)
Unluckily I am not a *BSD guy, but more a Linux one. Do we have any documentation on where those " judicious points" are located?
This has very little to do with Linux or BSD. It's really a UNIX scripting issue. There's not going to be any documentation on "judicious points" because there's probably at least a few dozen ways to do this, and probably only a handful of people who actually do this sort of work. You basically take the thing apart and "break" it in a way that causes it to do what you want.
For example,
Code:
# mdconfig FreeBSD-13.0-RELEASE-i386-disc1.iso
md0
# mkdir /tmp/x
# mount -t cd9660 /dev/md0 /tmp/x
# cat /tmp/x/etc/rc.local
[...]
trap true SIGINT # Ignore cntrl-C here
bsdinstall
if [ $? -eq 0 ]; then
dialog --backtitle "FreeBSD Installer" --title "Complete" --yes-label "Reboot" --no-label "Live CD" --yesno "Installation of FreeBSD complete! Would you like to reboot into the installed system now?" 0 0 && reboot
else
. /etc/rc.local
fi
[...]
This is a handy point in a standard FreeBSD OS install where you can intercept the launch of the installer and replace it with something else -- in our case over here, it's our automated no-keystroke system installer. In your case if you just want to twiddle settings, you might go right after bsdinstall.
Of course, this is probably going to be different for TrueNAS. But my point is that this stuff is mostly scripting. People are afraid to take it apart and make it their own. Don't be. It can be work, even significant work, but automation is a blast.