Revision history for APIDocumentation


Revision [2504]

Last edited on 2013-02-18 17:59:21 by PhilDaintree
Additions:
Tim has prepared some [[http://www.weberp.org/wiki/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:
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.


Revision [2503]

Edited on 2013-02-18 17:43:15 by PhilDaintree
Additions:
$Parameters['StockID'] = new xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for
$Parameters['Username'] = new xmlrpcval('admin');
$Parameters['Password'] = new xmlrpcval('weberp');
Deletions:
$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');


Revision [2439]

Edited on 2012-02-05 14:48:36 by vbfdkjsmhnvbgs
Additions:
<Tim>The only reason was that it could easily be included in webERP. The php-xmlrpc stuff is an extension and not included by default in php. Many hosting companies don't have it installed. It seemed the easiest way. </Tim>
xml-rpc is a protocol to use XML to make RPC - remote procedure calls.
<Tim>The xmlrpc protocol has these introspection function built in, so its easiest to use it to self document the api. As the api changes, so does the documentation!! Maybe this is too simple for KISS but I like things to be easy and simple</Tim>
Deletions:
xml-rpc is a protocl to use XML to make RPC - remote procedure calls.


Revision [2437]

Edited on 2012-02-02 18:37:36 by PhilDaintree
Additions:
It is necessary to be logged in to see the API manual, so I can't link to it here. But it shows all the functions in the API with a description of the parameters required and what each function does. It is quite limited at the moment, but shows what can be done with a bit of patience.
Deletions:
The [[http://www.weberp.org/weberp/doc/Manual/ManualAPIFunctions.php output of the API help file]] shows all the functions in the API with a description of the parameters required and what each function does. It is quite limited at the moment, but shows what can be done with a bit of patience.


Revision [2436]

Edited on 2012-02-02 18:30:33 by PhilDaintree
Additions:
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!! IMHO, it would have been much easier to write the manual for the functions in a separate html file and uncluttered the code of the API in the process - but it is clever (not KISS - which I prefer)
Deletions:
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!! It would have been much easier to write the manual for the functions in a separate html file and uncluttered the code of the API in the process.


Revision [2435]

Edited on 2012-02-02 18:28:27 by PhilDaintree
Additions:
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 method to be run together with the necessary parameters to the webERP API - the server script runs the API php functions exposed by the xml-rpc methods and returns the XML-RPC response as an XML payload. The phpxmlrpc class does the packaging converting the PHP variables and arrays to the XML required 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.
The beauty of XML-RPC is that the client calling the webERP XML-RPC server and performing native webERP functions can be called from any language (with XML-RPC bindings). I have used Vala, Genie and Python. Python particularly has been very straight forward as it has an xmlrpclib bundled with it. Of course a PHP client is also possible and is demonstrated below.
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!! It would have been much easier to write the manual for the functions in a separate html file and uncluttered the code of the API in the process.
The [[http://www.weberp.org/weberp/doc/Manual/ManualAPIFunctions.php output of the API help file]] shows all the functions in the API with a description of the parameters required and what each function does. It is quite limited at the moment, but shows what can be done with a bit of patience.
I have extended the API with a some new functions:
InvoiceSalesOrder - to invoice sales orders directly assuming the entire order is delivered - it cannot deal with controlled stock items though. However, it does process invoices in much the same way as standard webERP with updates to the stock quantities dispatched, GL entries and records required to record taxes and sales analysis records.
CreateCreditNote - to create a credit note from some base header data and an array of line items (as an associative array. In the same way as the InvoiceSalesOrder function this does all the same processing as a standard credit note from the interface in webERP.
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:
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 method to be run together with the necessary parameters to the webERP API - the server script runs Tim's php functions exposed by the xml-rpc methods and returns the XML-RPC response as an XML payload. The phpxmlrpc class does the packaging converting the PHP variables and arrays to the XML required 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.
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!!
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.


Revision [1755]

Edited on 2010-01-22 02:31:37 by PhilDaintree
Additions:
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:
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.


Revision [1533]

Edited on 2009-07-14 19:05:09 by PhilDaintree
Additions:
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:
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 [1479]

Edited on 2009-05-03 21:59:34 by PhilDaintree
Additions:
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:
Here is a [[http://schofield.homelinux.net/xmlrpc.zip demonstration of the api at work]]


Revision [1478]

Edited on 2009-05-03 21:54:48 by PhilDaintree
Additions:
$Parameters['StockID'] = xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for
Deletions:
$Parameters['StockID'] = xmlrpcval('DVD_TOPGUN'); //the stockid of the item we wish to know the balance for


Revision [1472]

Edited on 2009-05-01 08:04:55 by TimSchofield
Additions:
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 PhilDaintree
Additions:
echo '<html><head>Test Tims webERP API</head><body>';
Deletions:
echo '<html><head>Test Tim's webERP API</head><body>';


Revision [1470]

Edited on 2009-05-01 02:55:09 by PhilDaintree
Additions:
echo '<html><head>Test Tim's webERP API</head><body>';
echo '</body></html>';
Deletions:
%%
<html>
<head>Test Tim's webERP API</head>
<body>
%%
%%</body>
</html>%%


Revision [1469]

Edited on 2009-05-01 02:53:48 by PhilDaintree
Additions:
%%
%%
%%(php)<?php
?>%%
%%</body>
Deletions:
%%(php)
<?php
?>
</body>


Revision [1468]

Edited on 2009-05-01 02:52:33 by PhilDaintree
Additions:
<html>
<head>Test Tim's webERP API</head>
<body>
?>
</body>
</html>%%
Deletions:
?>%%


Revision [1467]

Edited on 2009-05-01 02:51:36 by PhilDaintree
Additions:
/*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');
Deletions:
$Parameters['StockID'] = 'DVD_TOPGUN'; //the stockid of the item we wish to know the balance for
$Parameters['Username'] = 'admin';
$Parameters['Password'] = 'weberp';


Revision [1466]

Edited on 2009-05-01 02:04:15 by PhilDaintree
Additions:
//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");
Deletions:
//you need to include the phpxmlrpc class - see link above
include ("xmlrpc.inc");


Revision [1465]

Edited on 2009-05-01 01:49:53 by PhilDaintree
Additions:
//the xmlrpc class can output some funny warnings so make sure notices are turned off
error_reporting (E_ALL & ~E_NOTICE);


Revision [1464]

Edited on 2009-05-01 01:46:15 by PhilDaintree
Additions:
//you need to include the phpxmlrpc class - see link above
include ("xmlrpc.inc");


Revision [1463]

Edited on 2009-04-30 21:28:42 by PhilDaintree
Additions:
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 PhilDaintree
Additions:
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:
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 to the XML-RPC server - the server returns an XML payload containing the results of the call.


Revision [1461]

Edited on 2009-04-30 21:17:23 by PhilDaintree
Additions:
//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 PhilDaintree
Additions:
$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<sizeof($answer[1]);$i++) {
echo '<br>' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand';
}
Deletions:
$signature = php_xmlrpc_decode($response->value());


Revision [1459]

Edited on 2009-04-30 20:51:22 by PhilDaintree
Additions:
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:
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.


Revision [1458]

Edited on 2009-04-30 20:49:26 by PhilDaintree
Additions:
%%http://www.yourdomain.com/webERP/api/api_xml-rpc.php%%
Deletions:
"http://www.yourdomain.com/webERP/api/api_xml-rpc.php"


Revision [1457]

Edited on 2009-04-30 20:48:42 by PhilDaintree
Additions:
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 to the XML-RPC server - the server returns an XML payload containing the results of the call.
The clever thing about XML-RPC is that it is the simplest protocol around for doing web-services. The newer and MUCH more complex SOAP - Simple Object Access Protocol - is quite involved and complicated and therefore doesn't belong in webERP!!
In fact this XML-RPC "Server" in webERP is just the script:
Deletions:
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:


Revision [1456]

Edited on 2009-04-30 20:42:34 by PhilDaintree
Additions:
//if your webERP install is on a server at http://www.yourdomain.com/webERP
$ServerURL = "http://www.yourdomain.com/webERP/api/api_xml-rpc.php";
Deletions:
$ServerURL = "http://www.yourdomain.com/api/api_xml-rpc.php";


Revision [1455]

Edited on 2009-04-30 20:34:18 by PhilDaintree
Additions:
%%(php)
<?php
?>%%


Revision [1454]

Edited on 2009-04-30 19:58:07 by PhilDaintree
Deletions:
[code]
[/code]


Revision [1453]

Edited on 2009-04-30 19:51:33 by PhilDaintree
Additions:
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 method to be run together with the necessary parameters to the webERP API - the server script runs Tim's php functions exposed by the xml-rpc methods and returns the XML-RPC response as an XML payload. The phpxmlrpc class does the packaging converting the PHP variables and arrays to the XML required 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.
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:
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.


Revision [1452]

The oldest known version of this page was created on 2009-04-30 19:43:37 by PhilDaintree
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki