|
|
|
Web-cp 0.6 boasts an XML-RPC based API that can be used by external application to do various things. FrameworkWeb-cp uses the XMLRPC functions/classes written by Keith Devens. On top of that is a thin layer that interfaces the hooks system with XML-RPC. In addition, system.multicall, system.cascadecall (custom to web-cp) and system.listMethods are also implemented. Inner workingsThe file web/rpc.php functions largely in the same way as web/index.php, but instead of accepting query strings and outputting HTML, it uses XML. Authentication is handled by sending either a username, domain and password, or username, domain, time (which is used as a salt) and a password hash. This is than verified against the database and a session key is returned. This session key (the webcp_tag) is valid for 5 minutes, which should be more than enough for simple calls. Remeber, the XML-RPC API is meant for automated batch processing, etc. After that, the user executes calls by sending this session key along. Sending parameters
UsageFamiliarity with XML-RPC and an appropriate library is assumed. You begin by calling the system.login method with a single paramater: a struct.
You will either get back an error, or the session key (a 32 character base64 string, beginning with a +) You can now make any available call, passing the session key as the first parameter and optionally any data in a struct as the second parameter. For a list of available methods, use system.listMethods. Error codes
Any error codes not in the X0XX format are method specific and could mean different things depending on which method was called. system.multicallYou can call multiple methods in one request. See documentation on system.multicall on how to use this. If your first called method is system.login, no session key needs to be specified. If system.login is not part of the system.multicall, only the first method call needs to have a valid session key, you can leave the other blank or omit them entirely. system.cascadecallWorks like system.multicall, except the output of one call is passed as input to the next. The chain will only be executed until an error occurs. This means that you may not get as many responses as requests. system.multicalls can be nested in system.cascadecalls and vice versa. If a system.multicall is nested inside a system.cascadecall, each call will receive the response from the parent call. This can can be used to create a reseller, domain and user at once, or even mutliple resellers/domains/users. Notice: "unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 2353 of 2367 bytes" (...repeated 2 times) |