Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229110

IONIC call webservice token

$
0
0

The thing is that I have the code in AngularJS that works with this api.
But i cant do the translate.I write down the .html file and the .js file .

<title>Demo ESWebApi Calls</title>
<script src="Scripts/libs/jquery/jquery-1.11.2.min.js"></script>
<script src="Scripts/libs/jquery-ui/jquery-ui-1.11.2.js"></script>
<script src="scripts/ModelViewJS.js"></script>

--- Call Web API TEST GEM1---

    </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));
}

});

});

Scroller (folder/scrollerName): ESWBCat/WEBAPI_Pelatis
Command id: CreateUpdateCustomer
MasterTable: ESFITradeAccount

Viewing all articles
Browse latest Browse all 229110

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>