Scroller (folder/scrollerName): |
ESWBCat/WEBAPI_Pelatis |
Command id: |
CreateUpdateCustomer |
MasterTable: |
ESFITradeAccount |
</table>
<div>
<h4>--- Info Result details ---</h4>
<h4>Auth Web API Token:</h4>
<p id="token"></p>
<p>-----</p>
</div>
</div>
/*
Following are the variables required to connect with WebAPI.
You need to modify them accordingly. Yu don;t need to change the token variable, since it will be updated by the login call.
-- variables description --
webapihost: the http(s) address of the WbAPI server
scrollerid: The scroller ID (used as an example in our case)
commandid: The automation ID (used as an example in our case)
token: The authentination Web API token returned by the call to the Login API
*/
var webapihost = “http://79.129.114.69:81/ebswebapi/”;
var scrollerid = “ESWBCat/WEBAPI_Pelatis”; // For our example, the View (scroller) ID that will be called
var commandid = “CreateUpdateCustomer”; // For our example, the Automation Command ID that will be called
var mastertableid = “ESFITradeAccount”;
var token = “”;
/*********** DEMO ************/
$(document).ready(function () {
/*
Call login API
*/
$.ajax({
url: webapihost + "api/login",
type: "POST",
data: JSON.stringify({
/*
Following are the Credentials required to connect to the WebAPI server. Valiable model contains the credensial as they would be entered by an EBS user
*/
SubscriptionPassword: 'passx',
model: {
BranchID: "01",
LangID: "el-GR",
UserID: "khcadmin",
Password: "P@ssw0rd"
}
}),
contentType: "application/json; charset=utf-8",
success: function (result) {
token = result.Model.WebApiToken;
document.getElementById("token").innerText = token;
/*
After successfull loging in you may process with thw other calls, you have a valid token and you may proceed with other calls.
*/
GetUpdatePersonData(token);
},
error: function (error) {
document.getElementById(“token”).innerText = “error:” + JSON.stringify(error);
console.log(“error:” + JSON.stringify(error));
}
});
});