Using jQuery to Search Sumo Logic (API)
Pretty simple to do, here is the primary command that you would run to hit the API (jQuery/AJAX)
$.ajax
({ type: "GET",
url: $sumoURL,
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa($sumoAccessID+":"+$sumoAccessKey));},
async: false,
success : function(JSONdata)
{
response = JSONdata;
}
});
the $sumoURL is the encoded URL for the search API, the key and ID should be self explanatory. One warning, the access key and id will be plaintext in the HTML file, so be careful.
The data is returned in the expected JSON format from the API, reach out for additional code samples to parse through it.
Please sign in to leave a comment.
Comments
0 comments