Making api call for listing watcher with callWithInternalUser


(Pradeep) #1

How to make an api call to list watcher detail using callWithInternalUser as the logged in user
manage_watcher will be disabled.

I have tried the below logic but getting invalid api error.
i also tried calling watcher.get request even its invalid api.
Any inputs on this ?

const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin');

  callWithInternalUser('/api/watcher/watch', {
    id: request.params.id,
  }).then((hit) => {
    console.log('trying to get data as internal user');
    console.log(hit);
  });