JavaScript (jQuery Ajax) β All monitors
var apiUrl = 'https://api.mxtoolbox.com/api/v1/Monitor';
var apiKey = '00000000-0000-0000-0000-000000000000';
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(result) {
// OnSuccess Callback
console.log(result);
},
error: function(xhr, status, error) {
// OnError Callback
},
beforeSend: function(xhr) {
if (apiKey) {
xhr.setRequestHeader('Authorization', apiKey);
}
}
});
JavaScript (jQuery Ajax) β Filtered by command, name & tag
var command = 'mx';
var name = 'example.com';
var tag = 'production';
var apiUrl = 'https://api.mxtoolbox.com/api/v1/Monitor?command=' + command +
'&name=' + name + '&tag=' + tag;
var apiKey = '00000000-0000-0000-0000-000000000000';
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(result) {
// OnSuccess Callback
console.log(result);
},
error: function(xhr, status, error) {
// OnError Callback
},
beforeSend: function(xhr) {
if (apiKey) {
xhr.setRequestHeader('Authorization', apiKey);
}
}
});
Curl β All monitors
curl -X GET \
"https://api.mxtoolbox.com/api/v1/Monitor" \
-H "Authorization: 00000000-0000-0000-0000-000000000000"
Curl β Filtered by command, name & tag
curl -X GET \
"https://api.mxtoolbox.com/api/v1/Monitor?command=mx&name=example.com&tag=production" \
-H "Authorization: 00000000-0000-0000-0000-000000000000"