Help with setting Document Root via API

I'm having trouble figuring out how to change the document root via the API. We want to use www as the document root instead of public_html, and we'd like to do this programmatically during a setup user script instead of having to manually do it via the web interface. How can we set or change the document root via the API or in some other way during this script?

Status: 
Closed (fixed)