LXC container APIs vs LXC command line utilites

Using LXC containers I’m trying to transform it into a NAT like network topology. For this I succeeded creating NAT like container with iptables, dnsmasq etc., like services running in it and also made it flexible enough to move from one part of the network to other.

But now I tried of recreating the whole construct using LXC container API’s. This time my code is not working properly like,
I modified /var/lib/lxc/nat/config for creating/adding a new interface to the container and when started the container using container->start(container) API it’s not creating the interface at all, but when started with lxc-start container via system command it’s adding interface. FYI it starts the container but not exhibiting the required property that mentioned in conf file.
Also in the container I tried to run DHCP server and added it required parameters into the respective configuration file but they didn’t reflect the dnsmasq when tried to trigger them using container->attach_run_wait( ) , But when tried echoing the command by lxc-attach container command it works fine.

Did I miss somewhere while creating or managing container APIs, or is there any limitations for these APIs?