Getting started
This is a tutorial how to get data from the RostarCas Web API using jQuery. To call any function on the web api you need a WebApiTicket
Steps to use a call
Authenticate
To obtain a WebApiTicket call the login function (login documentation)
function login(username, password) {
var uri = 'https://server/api/Auth/Login';
$.ajax({
type: 'POST',
url: uri,
data: { 'UserName': username, 'Password': password },
success: function (data) {
console.log(data);
alert(data.Ticket);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
login('JohnMarks','Ax4$300G');
Call a function on the Web API
To call a function on the web api you need to put the WebApiTicket in the http request header
function getUser(ticket) {
var uri = 'https://server/api/User';
$.ajax({
type: 'GET',
url: uri,
headers: {
WebApiTicket: ticket
},
success: function (data) {
console.log(data);
} ,
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
getUser('A445909FDDER.. etc'); // put the token you got from the login call in here.