11-12-2017, 06:00 PM,
|
|
s4m3shms
Member
 
|
Posts: 5
Threads: 2
Joined: Nov 2017
|
|
API integration with .net Web application
Hello all
Am quite new to webErp, I have an in-house developed .net application which I want to communicate with webErp through available XMLRPC APIs. Use cases will be like posting a transaction entry from the .net web application to webErp.
Could you provide me with some reference links or starting points to achieve this?
Thanks in advance
Regards
Sume MS
|
|
11-12-2017, 06:41 PM,
|
|
s4m3shms
Member
 
|
Posts: 5
Threads: 2
Joined: Nov 2017
|
|
RE: API integration with .net Web application
Thanks Tim for quick response
I could find the API integration from PHP which is pretty straightforward using XML-RPC.
Do you have any .net library suggestions?
Regards
Sume MS
(11-12-2017, 06:28 PM)falkoner Wrote: There is an API tutorial I wrote in the manual which you should have as part of your implementation.
Tim
|
|
11-12-2017, 07:19 PM,
(This post was last modified: 11-12-2017, 07:50 PM by s4m3shms.)
|
|
s4m3shms
Member
 
|
Posts: 5
Threads: 2
Joined: Nov 2017
|
|
RE: API integration with .net Web application
Thanks Tim
Definitely, this would be a great starting point.
Regards
Sume MS
One more question,
Is it possible to have multiple databases in the api/api_php.php if I want to work on multiple companies from the application?
Regards
Sume MS
Sorry I found this is listed as a limitation of the design. Since it is mandatory for my application to work with multiple companies at the same time, I am thinking to create an api that can modify the api_php.php with required corresponding database name before every transaction.
Any comments?
regards
Sume MS
|
|
11-12-2017, 09:33 PM,
|
|
TimSchofield
Tim Schofield
      
|
Posts: 1,319
Threads: 22
Joined: Mar 2015
|
|
RE: API integration with .net Web application
Hi, the problem with modifying the api is always to keep compatibility with existing applications that use it.
I would do something like the following (Nb I haven't tried this, so you may need to experiment a little)
Change each function call like this:
function InsertBranch($BranchDetails, $user, $password) becomes function InsertBranch($BranchDetails, $user, $password, $database_name='')
Then each function has a line
$db = db($user, $password);
which needs to be
$db = db($user, $password, $database_name);
Then within api_php.php the function declaration becomes:
function db($user, $password, $database_name) {
if (!isset($_SESSION['AccessLevel']) or $_SESSION['AccessLevel'] == '') {
// Login to default database = old clients.
if ($user != '' and $password != '') {
global $api_DatabaseName;
if ($database_name != '') {
$api_DatabaseName = $database_name;
}
$rc = LoginAPI($api_DatabaseName, $user, $password);
if ($rc[0] == UL_OK) {
return $_SESSION['db'];
}
}
return NoAuthorisation;
} else {
return $_SESSION['db'];
}
}
As I said I haven't actually tried it, but would be interested to know if it works out :-)
Tim
|
|
11-13-2017, 04:08 PM,
(This post was last modified: 11-13-2017, 04:45 PM by s4m3shms.)
|
|
s4m3shms
Member
 
|
Posts: 5
Threads: 2
Joined: Nov 2017
|
|
RE: API integration with .net Web application
Hi
Interesting idea, I should give it a try and would let you know.
Thanks very much
Regards
Sume MS
(11-12-2017, 09:33 PM)falkoner Wrote: Hi, the problem with modifying the api is always to keep compatibility with existing applications that use it.
I would do something like the following (Nb I haven't tried this, so you may need to experiment a little)
Change each function call like this:
function InsertBranch($BranchDetails, $user, $password) becomes function InsertBranch($BranchDetails, $user, $password, $database_name='')
Then each function has a line
$db = db($user, $password);
which needs to be
$db = db($user, $password, $database_name);
Then within api_php.php the function declaration becomes:
function db($user, $password, $database_name) {
if (!isset($_SESSION['AccessLevel']) or $_SESSION['AccessLevel'] == '') {
// Login to default database = old clients.
if ($user != '' and $password != '') {
global $api_DatabaseName;
if ($database_name != '') {
$api_DatabaseName = $database_name;
}
$rc = LoginAPI($api_DatabaseName, $user, $password);
if ($rc[0] == UL_OK) {
return $_SESSION['db'];
}
}
return NoAuthorisation;
} else {
return $_SESSION['db'];
}
}
As I said I haven't actually tried it, but would be interested to know if it works out :-)
Tim
Hi
As a quick workaround, if I keep multiple folders for APIs with different databases, would it work?
For example:
http://domain.com/webERP/api-company1/api_xml-rpc.php
http://domain.com/webERP/api-company2/api_xml-rpc.php
http://domain.com/webERP/api-company3/api_xml-rpc.php
Regards
Sume
|
|
|