I have created a custom REST to get balance
$API_ACTIONS[“getBalance”] = function(Request $request, Response &$response) {
$username= Param(“username”, Route(1)); // Get parameter from $_GET or $_POST
if ($username!== NULL)
WriteJson(ExecuteRow(“SELECT closingbalance FROM balance WHERE id = '” . AdjustSql($username) . “'”, ));
};
How can my client access this resource with his username and password without using login form.
it has to be access through api only
login url = /api/login/?username=myusername&password=mypassword
the login url return true .
how can I combined this 2 url to access my custom REST by my client with authentication. #I have read the REST API in help file but unable to do it.
How can I combine the 2 url api
1)login url = /api/login/?username=myusername&password=mypassword
2)access the data url = /api/getBalance/521485
is it good to put the username and password in the same url as
/api/getBalance/myusername/mypassword/521485
If I put the username and password in the url.
what will be the code for login
$API_ACTIONS[“getBalance”] = function(Request $request, Response &$response) {
$login = ##Code for Login##
if($login){