Delete a model via Websocket Command

Hi,
I tried to delete a model from this command.

http://localhost:3344/printer/api/my_printer?a=removeModel&data=46&apikey=my_key

However the file doesn't get deleted.
I guess my problem is the "data=" parameter.
How do I pass the "id" for the gcode file here? (<json object properly url-escaped>)
Thanks for your help! Kind regards, Andreas

Comments

  • If you look into docs you see

    removeModel

    Parameter: id (int) = id of g-code that will be deleted.


    So json representation is {"id":46} which is url encoded %7B%22id%22%3A46%7D which you enter as data.

    In javascript console you can enter

    encodeURIComponent('{"id":46}')

    To encode a string.

  • Thanks for your reply. I tried 'id:46' and url encoded it. Didn't know that it has to be '"id":46'.
    Now it's clear, thank you!
  • Parameter data is always a json object hence in {} and from json standard parameter are in double quotes. 
  • Repetier said:
    If you look into docs you see

    removeModel

    Parameter: id (int) = id of g-code that will be deleted.


    So json representation is {"id":46} which is url encoded %7B%22id%22%3A46%7D which you enter as data.

    In javascript console you can enter

    encodeURIComponent('{"id":46}')

    To encode a string.

    It's working now. Thanks for the help!
  • Repetier said:
    Parameter data is always a json object hence in {} and from json standard parameter are in double quotes. 
    Thanks, yes it's working now. Is there also a command to set the extruder / heatbed temp. from a command? 

  • Sure,
    setExtruderTemperature  {temperature: temp, extruder: extr}
    setBedTemperature  {temperature: temp, bedId: idx}
    setChamberTemperature  {temperature: temp, chamberId: idx}

    List shows command and data required.
  • Repetier said:
    Sure,
    setExtruderTemperature  {temperature: temp, extruder: extr}
    setBedTemperature  {temperature: temp, bedId: idx}
    setChamberTemperature  {temperature: temp, chamberId: idx}

    List shows command and data required.
    Thanks a lot. Where can I find all commands? It seems that the commands above are missing in your docs.#
    https://www.repetier-server.com/manuals/programming/API/index.html

    Do I miss something? I need some more commands, but I don't want to bother you for each single commands.
    So if you have a full list, I would appreciate it.
    Thanks for your help!
  • Well that is the list, but there are in deed some missing.
    Best way to find them is open debug tools->Network in chrome and  reload. Then search for file socket and see frames being send. Then execute the operation needing them in our gui and see what it sends. Also gives nice examples on send data and answer.

    I hope to get some time to add newer api calls.
  • Repetier said:
    Well that is the list, but there are in deed some missing.
    Best way to find them is open debug tools->Network in chrome and  reload. Then search for file socket and see frames being send. Then execute the operation needing them in our gui and see what it sends. Also gives nice examples on send data and answer.

    I hope to get some time to add newer api calls.
    Hi,
    I'm sorry to bother you again, however I struggle to get the commands from the Network-Console as you mentioned.
    I also struggle with the "listJobs" command. I always get an empty object back, although the print is running.
    Is this command deprecated?

    Those commands are missing so that I can finish my application.

    • startPrint (startJob doesn't seem to work)
    • getCurrentPrintInfo
    • rebootServer
    • shutdownServer
    • uploadCcode to specific group

    Thank you for your time and assistance!

    Best,

    Andreas


  • Running job is not included in listJobs, only extra jobs stored.
    What is the problem with network console. Open it reload page so file appears, search for sock and you will see it. It is always the last one that is active. Select frames and you see full communication.

    To start a stored model you need copyModel with autostart=true. Works only if no job is running. Otherwise it will just queue the model.
    startJob starts a queued job.

    Uploads are not done over websocket, see
    https://www.repetier-server.com/using-simplify-3d-repetier-server/
    how to do. group is the upload group. # is default group.

    shutdown/reboot are no server commands. On pi they are added as external commands so you need

    listExternalCommands

    Parameter: None.

    Response

    [ { "confirm": "", "id": 0, "name": "Start webcam streamer" }, { "confirm": "Really shutdown?", "id": 1, "name": "Shutdown" } ]

    Lists all available external commands. Some commands should ask a question to confirm it.

    runExternalCommand

    Parameter: id (int) = Command to run.

    Response

    {}

    Starts a command by command id.


    To run them.

    Action stateList returns basic state for all printers.


Sign In or Register to comment.