Test it in the User Interface

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 …

Spread the love

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 sdk.cPanel.net 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

Recommendations From The Field Working on the front lines, I have an opportunity to see how cPanel/WHM customizations are implemented in practice.  Often, I encounter novel ways of ...
MySQL 5.1 End Of Life As of December 31, 2013, Oracle will no longer distribute updates for MySQL 5.1. To facilitate migration from MySQL 5.1 to 5.5 or 5.6, we will continu...
Saying Goodbye to PHP 5.4 Sometimes you have to know when to call it a night and retire gracefully. PHP 5.4 goes End of Life on September 14, 2015, which means it’s time for a ...
What’s going on in WHM? Hi Everyone, Adam here. I wanted to spend some time spelling out what’s going on in the user experience of cPanel & WHM. Plugin developers should ...
Spread the love

Posted by News Monkey