// Frontend API Login
// Provided by API owner
// var apiUsername = "xxxxxx";
// var apiKey = "xxx";
$.ajax({
type: 'POST',
url: "http://127.0.0.1:8888/practice/phspark/api-v1-login",
data: "username=" + apiUsername + "&key=" + apiKey,
dataType: "JSON",
beforeSend: function() {},
complete: function() {},
success: function(response) {
console.log(response);
},
error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
}
});
var apiToken = '3c45ff91c4ba7f72b75aa170c1'; // Api token will be found when call for login [look at above]
// Call for Frontend API data
$.ajax({
type: 'POST',
url: "http://127.0.0.1:8888/practice/phspark/index.php?route=api/test/index&api_token=" + apiToken,
data: "",
dataType: "JSON",
beforeSend: function() {},
complete: function() {},
success: function(response) {
console.log(response);
},
error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
}
});