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

How to trace the cPanel API At this point, cPanel’s APIs are not 100% documented.  We are working on it and hope to have complete API docs up in a few months.  I’ve written a Cus...
Ruby, Ruby Gem, Rails and Mongrel Troubleshooting Guide You’ve taken the plunge and installed Ruby on your cPanel system using our /scripts/installruby command. Now, you are preparing to run Rails applicati...
The Internet Belongs to All of Us | Net Neutrality The internet  is a crazy, amazing, and magical place filled with interesting ideas and endless opportunities. Companies like Netflix, Facebook, and of...
Being a Good Open Source Community Member: Why we hesitated on MyS... The open source community is great, largely because it is powered by the passion of its members. Much of that passion is rooted in Doing What’s Right™...
Spread the love

Posted by News Monkey