I fail to use the monitoring api | pls help


Hey guys! So I am currently trying to fetch the json data from “https://mycloud/ocs/v2.php/apps/serverinfo/api/v1/info” however I fail to do so via a script.

const got = require("got");

const options = {
  method: 'POST',
  url: 'https://username:password@mycloud/ocs/v2.php/apps/serverinfo/api/v1/info?format=json'
got(options).then(response => {
... stuff that never happens anyways so I left it out

If I try a get request I get a 401 and if I do a post I get a 405. can anyone tell me why and how to properly fetch the data from that endpoint in js? I couldnt find any docs for it.

Appreciate everyones answer

UPDATE: I figured out what the issue was. total beginner issue. Didnt think about the space in the test-user name -.-

Now I face the issue of only grabbing the right data tho. can someone please give me an example on how to log for example the nextcloud version? Im used to sites where I can just do like


but in this case this doesnt seem to work. maybe im just too dumb ¯\_(ツ)_/¯

1 Like