It would be better to use the API to manage the server, since more WHM functionality would be available using the API. Also, the API is the supported method over using /scripts or running commands using /usr/local/cpanel/bin binaries. Here's our documentation on the API: