Revision [1452]

This is an old revision of APIDocumentation made by PhilDaintree on 2009-04-30 19:43:37.

 

webERP API


This is the for dummies version - since that is the standpoint I am looking at it from!!

The API uses the phpxmlrpc class from Useful Inc originally developed by Edd Dumbill

(Why didn't you use the PHP built in stuff Tim? I believe it was based on this class?)

xml-rpc is a protocl to use XML to make RPC - remote procedure calls.

Simply put the XML contains the method of the remote procedure call and any parameters and their data types and is sent over http to the XML-RPC server - the server returns XML containing the results of the call.

In fact this "Server" in webERP is just the script:

"http://www.yourdomain.com/webERP/api/api_xml-rpc.php"

there is no daemon required to field calls to the "server" it is just a script that is http posted to by the XML-RPC call sending the XML encoded call and parameters to the API - the script runs Tim's php functions exposed by the xml-rpc methods and returns the XML-RPC response as XML. The phpxmlrpc class does the packaging converting the PHP variables and arrays to the XML requires for the XML-RPC call and also has the functions to convert the XML response into something useable in PHP without having to write the XML parsing routines.

I read a how-to on XML-RPC with PHP which contains a little more detail of what is going on and was a useful primer for the concepts.

[code]
$ServerURL = "http://www.yourdomain.com/api/api_xml-rpc.php";
$DebugLevel = 0; Set to 0,1, or 2 with 2 being the highest level of debug info

$Parameters = array();
$Parameters['StockID'] = 'DVD_TOPGUN';
the stockid of the item we wish to know the balance for
assuming the demo username and password will work !
$Parameters['Username'] = 'admin';
$Parameters['Password'] = 'weberp';

$msg = new xmlrpcmsg("weberp.xmlrpc_GetStockBalance", $Parameters);

$client = new xmlrpc_client($ServerURL);
$client->setDebug($DebugLevel);
$response = $client->send($msg);
$signature = php_xmlrpc_decode($response->value());

[/code]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki