Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API integration with .net Web application
11-13-2017, 04:08 PM, (This post was last modified: 11-13-2017, 04:45 PM by s4m3shms.)
#7
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
Reply


Messages In This Thread
RE: API integration with .net Web application - by s4m3shms - 11-13-2017, 04:08 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)