Now i am using
var loginClient = new JSONRpcClient({
‘url’: ‘//user-api.simplybook.me/login’,
‘onerror’: function (error) {
alert(error);
}
});
var token = loginClient.getToken(‘narendra’, ‘5501cb0d7052b9d95ba78559ed41cd65c7bc0d3a51e21e259cbe092142f7537e’);
You do not need to get token again. and this line var getToken($companyLogin, $apiKey); does not have any sens.
@‘X-Company-Login’: ‘{narendra}’,@ - here you have to pass company login without {}
@‘X-Token’: ‘{5501cb0d7052b9d95ba78559ed41cd65c7bc0d3a51e21e259cbe092142f7537e}’@ - here you have to pass token, instead of api key, as i said before.
Please see example:
var loginClient = new JSONRpcClient({
‘url’: ‘//user-api.simplybook.me/login’,
‘onerror’: function (error) {
alert(error);
}
});
var token = loginClient.getToken(‘narendra’, ‘5501cb0d7052b9d95ba78559ed41cd65c7bc0d3a51e21e259cbe092142f7537e’);
var client = new JSONRpcClient({
‘url’: ‘https://user-api.simplybook.me/’,
‘headers’: {
‘X-Company-Login’: ‘narendra’,
‘X-Token’: token
},
‘onerror’: function (error) {
alert(error);
}
});