After spending time in the Developer section of the cPanel Community Forums, we’ve found a commonly asked question: “Why won’t my script work with XYZ function using the XML/JSON-API?”

Rewinding a bit, the purpose of the XML/JSON API is to allow usage of cPanel & WHM functions through applications or scripts. Naturally, the first question we often ask, when trying to figure out why a script isn’t working, is if the user is trying to do something that they couldn’t normally do through cPanel & WHM.

For example, let’s say you’re trying to park a domain on top of an existing domain. Parking a domain is like adding an additional domain name for the same content in your hosting account. Given this option is allowed by your hosting provider, the first thing to do would be to attempt to add the parked domain through cPanel. Running through the process of parking the domain through cPanel will give you, the user, a good sense of what’s actually happening when parking a domain.

After testing through the interface and finding out more about the function, the next step would be to consult our documentation at to find more about the module name and function. Following the parking a domain example, we find in the documentation that the name of the module is “Park”, with function “park”. (On a side note, there are also other functions available within the Park module, including “unpark”, “listparkeddomains”, and “listaddondomains”.)

In this case, we’re only interested in using the “domain” parameter, since we’re wanting to park the new domain on the primary domain for the account. If the user wanted to park a domain onto a subdomain in the account, the user would also use the parameter, “topdomain”. This parameter would contain the name of the subdomain to attach the new parked domain to. Often, the error in the script has to do with incorrect parameters, or the order of parameters (for API1 functions) within the array.

So after testing the function through cPanel, then making sure you have the correct parameters passed in through the XML/JSON-API, you should be well on your way to troubleshooting your script.

Facebook Comments

More Stuff

Let’s Talk AutoSSL- The Updates! One of the more popular topics talked about amongst the cPanel Community is AutoSSL, a tool that automatically installs domain-validated SSL cert...
Brace Yourselves, NGINX is Coming Arguably, one of the most requested and popular feature requests submitted for cPanel & WHM has been the addition of the NGINX web serve...
Force HTTPS Redirection We’ve talked about SSL (secure socket layer) certificates both on the cPanel blog and at the 2018 cPanel Conference in Houston, Tx as well as many oth...
We Came, We Saw, We cPanel’d Outside the main entrance of CloudFest 2019- The .COM Dome Another CloudFest Conference is in the books for the cPanel Team! This year we attended t...
Spread the love

Posted by News Monkey