Api command with empty result

I used some command with success, but when I try commands like "Response" or "listJobs" I get an empty json.

Comments

  • Please post what you did send.
    http://localhost:3344/printer/api/<slug>?a=<websocket command>&data=<json object properly url-escaped>&apikey=<API key>>
    some commands require a valid slug name (like you see in url in frontend) or they return nothing. Others that do not depend on a printer ignore that part and work with any value. So maybe that was wrong?

  • I always use <slug> in my query but it doesn't work.
    For example with listJobs i use this code

    http://192.168.1.10:3344/printer/api/Prusa_i3_pro_b?a=listJobs&apikey=<my_key>;

    This is the result:
    {"data":[]}
  • You are missing the data parameter with url escaped json string of data. Even if no params are expected you should send {}. Not sure if that causes it, but that might be the reason it fails before getting to the function you want.
  • I've tried in this way:
    http://192.168.1.10:3344/printer/api/Prusa_i3_pro_b?a=listJobs&data={}&apikey=<my_key>

    Same result.
    Other commands works fine (for example listModels)
  • curl -k "http://127.0.0.1:3344/printer/api/Felix?apikey=mykey&a=listJobs&data=\{\}"

    {"data":[{"analysed":1,"created":1498813251000,"extruderUsage":[1422.2787734931335,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000],"filamentTotal":1422.2787734931335,"fits":true,"gcodePatch":"{}","group":"#","id":2,"lastPrintTime":148.00000000000000,"layer":100,"length":447455,"lines":11007,"materials":["x38UkoUpOt","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"name":"xyzCalibration_cube","notes":"","printTime":1312.5396289296680,"printed":13,"printedTimeComp":129.12927395958334,"radius":212.02885437011719,"slicer":"Slic3r","state":"stored","version":1,"volumeTotal":9073.2803465516936,"volumeUsage":[9073.2803465516936,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000,0.0000000000000000],"volumetric":false,"xMax":159.53100585937500,"xMin":77.469001770019531,"yMax":158.53100585937500,"yMin":76.469001770019531,"zMax":20.100000381469727,"zMin":0.0000000000000000}]}

    Is what I get when I try.

    listJobs will normally return an empty list as it is the waiting queue that normally is empty. Only if you start several jobs and you see in frontend file sin waiting queue it will return that list.

  • I usually start only one job: it could be that?
  • Yes, the running job is always excluded form the list. So if you have only one it gets automatically started and would not appear there. If you start a new print while printing it would appear here.
  • Ok now it's clear. Thank you very much.
Sign In or Register to comment.