Revision [1755]
Last edited on 2010-01-22 02:31:37 by PhilDaintreeAdditions:
Tim has prepared some [[http://www.weberp.org/uploads/ScreenShotUploads/xmlrpc.zip example scripts]] showing how a number of the API XML-RPC functions are called - these scripts can be put on a web-server outside a webERP installation - all you need to do is edit the config.inc file to give the system your webERP username and password and the URL of your webERP installation you wish to connect to.
Deletions:
Revision [1533]
Edited on 2009-07-14 19:05:09 by PhilDaintreeAdditions:
I have had a go at an example xml-rpc client script to retrieve the stock quantities of an item using the [[http://web-erp.cvs.sourceforge.net/viewvc/*checkout*/web-erp/webERP/doc/Manual/ManualAPIFunctions.php doc/Manual/ManualAPIFunctions.php]] as a template.
Deletions:
Revision [1479]
Edited on 2009-05-03 21:59:34 by PhilDaintreeAdditions:
Tim has prepared some [[http://schofield.homelinux.net/xmlrpc.zip example scripts]] showing how a number of the API XML-RPC functions are called - these scripts can be put on a web-server outside a webERP installation - all you need to do is edit the config.inc file to give the system your webERP username and password and the URL of your webERP installation you wish to connect to.
Deletions:
Revision [1478]
Edited on 2009-05-03 21:54:48 by PhilDaintreeAdditions:
$Parameters['StockID'] = xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for
Deletions:
Revision [1472]
Edited on 2009-05-01 08:04:55 by TimSchofieldAdditions:
Here is a [[http://schofield.homelinux.net/xmlrpc.zip demonstration of the api at work]]
Revision [1471]
Edited on 2009-05-01 02:55:35 by PhilDaintreeAdditions:
echo 'Test Tims webERP API';
Deletions:
Revision [1470]
Edited on 2009-05-01 02:55:09 by PhilDaintreeAdditions:
echo 'Test Tim's webERP API';
echo '';
echo '';
Deletions:
Test Tim's webERP API
%%
%%
%%
Revision [1469]
Edited on 2009-05-01 02:53:48 by PhilDaintreeAdditions:
%%
%%
%%(php) ?>%%
%%
%%
%%(php) ?>%%
%%
Deletions:
?>
Revision [1468]
Edited on 2009-05-01 02:52:33 by PhilDaintreeAdditions:
Test Tim's webERP API
?>
%%
Deletions:
Revision [1467]
Edited on 2009-05-01 02:51:36 by PhilDaintreeAdditions:
/*The trap for me was that each parameter needs to be run through xmlrpcval() - to create the necessary xml required for the rpc call
if one of the parameters required is an array then it needs to be processing into xml for the rpc call through php_xmlrpc_encode()*/
$Parameters['StockID'] = xmlrpcval('DVD_TOPGUN'); //the stockid of the item we wish to know the balance for
$Parameters['Username'] = xmlrpcval('admin');
$Parameters['Password'] = xmlrpcval('weberp');
if one of the parameters required is an array then it needs to be processing into xml for the rpc call through php_xmlrpc_encode()*/
$Parameters['StockID'] = xmlrpcval('DVD_TOPGUN'); //the stockid of the item we wish to know the balance for
$Parameters['Username'] = xmlrpcval('admin');
$Parameters['Password'] = xmlrpcval('weberp');
Deletions:
$Parameters['Username'] = 'admin';
$Parameters['Password'] = 'weberp';
Revision [1466]
Edited on 2009-05-01 02:04:15 by PhilDaintreeAdditions:
//you need to include the phpxmlrpc class - see link above - copy the whole directory structure of the class over to your client application
include ("xmlrpc/lib/xmlrpc.inc");
include ("xmlrpc/lib/xmlrpc.inc");
Deletions:
include ("xmlrpc.inc");
Revision [1465]
Edited on 2009-05-01 01:49:53 by PhilDaintreeAdditions:
//the xmlrpc class can output some funny warnings so make sure notices are turned off
error_reporting (E_ALL & ~E_NOTICE);
error_reporting (E_ALL & ~E_NOTICE);
Revision [1464]
Edited on 2009-05-01 01:46:15 by PhilDaintreeAdditions:
//you need to include the phpxmlrpc class - see link above
include ("xmlrpc.inc");
include ("xmlrpc.inc");
Revision [1463]
Edited on 2009-04-30 21:28:42 by PhilDaintreeAdditions:
I have had a go at an example xml-rpc client script to retrieve the stock quantities of an item using the doc/Manual/ManualAPIFunctions.php as a template.
Revision [1462]
Edited on 2009-04-30 21:19:51 by PhilDaintreeAdditions:
Simply put the XML_RPC call is XML that contains the method of the remote procedure call and any parameters and their data types and is sent over http as a POST to the XML-RPC server - the server returns an XML payload containing the results of the call.
Deletions:
Revision [1461]
Edited on 2009-04-30 21:17:23 by PhilDaintreeAdditions:
//need to figure out how to return all the error descriptions associated with the codes
Revision [1460]
Edited on 2009-04-30 21:13:49 by PhilDaintreeAdditions:
$answer = php_xmlrpc_decode($response->value());
if ($answer[0]!=0){ //then the API returned some errors need to figure out what went wrong
} else { //all went well the returned data is in $answer[1]
//answer will be an array of the locations and quantity on hand for DVD_TOPGUN so we need to run through the array to print out
for ($i=0; $i
echo '
' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand';
}
if ($answer[0]!=0){ //then the API returned some errors need to figure out what went wrong
} else { //all went well the returned data is in $answer[1]
//answer will be an array of the locations and quantity on hand for DVD_TOPGUN so we need to run through the array to print out
for ($i=0; $i
' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand';
}
Deletions:
Revision [1459]
Edited on 2009-04-30 20:51:22 by PhilDaintreeAdditions:
Tim's API help which itself is produced by an xml-rpc call to the API using the system.listMethods method (I think this is a phpxmlrpc method - not a webERP API method) - he then uses another system xml-rpc method of phpxmlrpc class to return the details of each method's parameters required. So the help file not only documents each of the API methods it is itself and illustration of how the API can be used!!
Deletions:
Revision [1458]
Edited on 2009-04-30 20:49:26 by PhilDaintreeAdditions:
%%http://www.yourdomain.com/webERP/api/api_xml-rpc.php%%