Yeah, I looks like it send only a GET request, because the answer are the current search jobs. Your code dont work, because a GET method dont accept a body, I also tried with POST, but same problem like in PrewinThomas answer. So I tried the libary @splunk/splunk-utils/search. And do a createSearchJob(). Then I looked in the dev-tools and got this Request. I modified it a bit : fetch('http://127.0.0.1:8000/de-DE/splunkd/__raw/services/search/jobs', {
headers: {
'content-type': 'application/x-www-form-urlencoded',
'x-requested-with': 'XMLHttpRequest',
'x-splunk-form-key': '<YOUR_KEY>',
},
body: new URLSearchParams({
search: 'search | makeresults 2',
output_mode: 'json',
}),
method: 'POST',
})
.then((r) => r.json())
.then((data) => console.log(data)); And this work! Anyways I guess I will first stick to the libary. Maybe later I can improve fetching the data. Here I get the request e.g. as fetch(). The x-splunk-form-key you can find other the cookies "splunkweb_csrf_token_8000".
... View more