[API] - Websockets Permission Issue

Hello,

I am using the latest version of the Repetier-Server and attempting to use the API via websockets per the guide.  I am able to receive all events correct, respond to pings and keep the connection alive however if I attempt to perform an action such as action: preheat via an already open websocket I get an error, "permission denied".

My Repetier-Server has no users defined and my connection string includes my API key: 
`ws://192.168.0.7:3344/socket/?lang=en&apikey=${apikey_sc1}`

If I attempt non-sensetive commands they work fine and get a response.  Upon login I do not get a "login required" message and after starting the socket I do get an event userCredentials returned:
  login: 'global',
  permissions: 65535,

Could you please point me in the right direction as I may be missing something obvious.

Comments

  • Can you show your request? From userCredentials you see all is ok, so I think the request is bad. Especially preheat has the permission denied answer when not all of these conditions are satisfied:

     if(printer != nullptr && (hasPermission(obj, out,Permission::PRINT)) && obj.count("extruder") == 1 && obj.count("bed") == 1 && obj.count("chamber") == 1) 

    I guess you have omitted one of the parameter extruder/bed/chamber so function does not see it. Permission denied is a bit misleading as it is only one reason, also the only one that happens with correct request implementation.
  • @Repetier Awesome support as always, thank you.  I do not use a chamber so I had omitted that, dumb mistake -- I now included chamber: 0 and I get an ok response!  The error message is a bit vague but nonetheless this is user error on my behalf, the Repetier-Server API docs does not list chamber as optional, I failed to notice:

    preheat (0.91.2)

    Parameter: extruder (int) = cooldown 0/no, 1/all extruders, bed (int) = preheat all beds, chamber (int) = preheat all cham

Sign In or Register to comment.