TheCrether / untis-node

A wrapper for the WebUntis API, made with Axios & Promises
https://thecrether.github.io/untis-node
0 stars 0 forks source link

API returns error "Method not found" / code -32601 #1

Closed KonstntinM closed 4 years ago

KonstntinM commented 4 years ago

I have the following issue. When I request a simple timetable with the getSimpleTimetable() method, the package returns this error: {"jsonrpc":"2.0","id":"req[object Object]","error":{"code":-32601,"message":"Method not found"}}

I guess the error is redirected from the Untis API, but I am not sure.

You can reproduce the error by creating a new node project, use the login() method to open a new connection and request a simple timetable.

My code looks like this:


const untis = require("untis-node")

/* ... */

app.get("/:classId", function (req, res, next) {

  const reqParams = {
    id: req.params.classId,
    type: 1
  }

  untis.getSimpleTimetable(reqParams)
    .then(res => {
      console.log(res)

    })
    .catch(err => { 
      console.error(err);
    })

})

/* ... */

I am using version 1.0.4 of the plugin.

I would be grateful if you could have a look at the problem @TheCrether .

TheCrether commented 4 years ago

looking into it!

TheCrether commented 4 years ago

So, I don't have that much time at the moment to look into this, but from what I can see, you gave the function an object, when the function takes mutliple parameters, documentation here: https://thecrether.github.io/untis-node/globals.html#getsimpletimetable

But to be honest, I don't think that my library is especially good, and as far as I can see, @TheNoim has an more maintained (and probably updated) library for webuntis, https://github.com/TheNoim/WebUntis and I suggest that you use his :)

KonstntinM commented 4 years ago

Sorry, I could / should have found this error myself... But thanks a lot!

TheCrether commented 4 years ago

No problem, happy to help