Send gCode file to printer server

2»

Comments

  • Using full api key is also possible as that allows root access.
    With websockets you get events for important changes - see api description at the bottom. But you always can also get same information with pulling data. You just need to know that before you were printing.
  • With the modelInfo API call, there is a response coming printTime, what is that field meaning?
    Also, we need to input 
    Parameter: id (int) = model id to retrieve.

    Is that id field mean, the gcode id which we get after uploading the file?
  • also, I believe the when we give an API call to copyModel, then it will appear in the listJob , so the last created jobId will be the last copyModel we uploaded, is this assumption correct?
  • edited July 2020
    I need the url format to use login API and get reply
  • printTime is print time estimated in seconds.
    id is the start of the filename if you look into the directory. It is also the id you use in copyModel or anything that references that file.

    The job id is not the same as the model id. Jobs have their own counter since you can also copy same file several times.

    There is no url format for login, use a pi key in direct url calls. A login session is only valid until you are logged out from websocket.
  • Of course, what i was asking is, once we issue the copyModel then if it is in the queue, how can we identify that job? The last id on the listJob API call?

    "There is no url format for login, use a pi key in direct url calls. A login session is only valid until you are logged out from websocket."

    I really dont know what is the format of 'direct url call', I just want to double-check from you.
  • What are the use cases of modelInfo and jobInfo APIs?
  • Als when a printing is going on, if we issue startJob with a job id, what wil happen?
  • > Als when a printing is going on, if we issue startJob with a job id, what wil happen?
    Nothing.

    >What are the use cases of modelInfo and jobInfo APIs?
    We use it to show them in gcodes tab of printer and run operations like preview, start ,.. on them when user selects it.

    > Of course, what i was asking is, once we issue the copyModel then if it is in the queue, how can we identify that job? The last id on the listJob API call?

    It depends if a print would start automatically or not. Oncy copy is finished the event "gcodeInfoUpdated" is issued but that does not help you if you don't use websockets. So in case

    autostart printing: You see that a print job has started in state and get the id from there.

    Not started: There is a new file and it has the biggest id.

    > I really dont know what is the format of 'direct url call', I just want to double-check from you.

    I interpreted that as the API to websocket method bridge that you are already using all the time where a login exists. But with the bridge this command does not work.

  • In order to see the jobs using listJobm is the below formtet correct?

    server:3344/printer/api/slug?a=listJob&apikey=apikey
  • 1. after I call copyModel, nothing happens. why?
    2. Also is there an API call where we can check the jobId related to gcodeId?
    3. Even I give a copyModel to a printer which is free, it neither prints nor showing in listJob API, why?
  • Ok here the doc for tranlation:

    User websocket commands directly

    In the websocket chapter you will see all the small commands you normally use while you are displaying server status. Soem of them might also be useful for simple apps just wanting to show some informations. For these we offer a access over the REST api. The only thing that does not work are events as they are reported to open sockets only.

    http://localhost:3344/printer/api/<slug>?a=<websocket command>&data=<json object properly url-escaped>&apikey=<API key>>

    The above schema can be used to send any websocket command as REST call. Use GET or POST just as you like. For bigger data POSt should be preferred. You can replace apikey with sess, but you would normally do this only if you have no session open, so apikey is the normal way to use it.

    so apart from missing &data={} it is correct. For commands with content in data don't forget to url escape the json string.


    1. What do you send?

    2. No as already explained

    3. Check server.log - my guess is that the parameter are send in wrong syntax.

  • to view a list of all printers along with their status (ex- running, error, ready, offline, etc.), are there any API calls available to get these values..?

  • 1. How do I pause a job through API? there is no API endpoint for that
    2. If I pause through repetier interface, can I continue through API?
    3. If I stop a job using API, what will happen next? Will the job discarded and needed to restart the job from beginning?
  • Only the one you already know from the docs. There is also a info call to get a general status without websocket which is used to detect available printers, but informations are very limited.

    For pause send @pause message as gcode command,

    There is a api call for comtinue,

    After stop by user the print is stopped and gets deleted. But there are cases where the file remains. Normally when it stops due to an error from firmware or printer disconnect.
  • Regarding Pause, I am asking to pause an ongoing print for any reasons, and then continue, not to append a pause code on a predefined situation, just like we pause due to any reasons we do during listening to music and play. At the repetier printer management page, that feature is available, but can we achieve this through an api call?
  • can you send me sample api and api request body for to get data from web sockets
  • You can add manual commands any time so sending @pause will stop current print of the printer.

    Right click in our gui and select inspect element. Select network tab and reload. Search for „socket“ and select it. Then select frames, you will see the comlete communication on the socket between gui and server. You can use this to learn, see responses and see how to do it by just executing the task you want to program.
  • A printer is offline, but when the getting printer api call, it shows as online (1), why is that? Printer Status
  • How i can use startJob command?
  • @ishthi83 Sure printer is offline? Often processor gets powered vie usb so it is still reachable even without main power. So since printer responds it is online.

    @User_Repetier
    From Docs:

    startJob

    Parameter: id (int) = print job to start.

    Response

    {}

    Starts a print.


    So after the job is uploaded or copied to job queue call the action with id=jobid_in_job_queue
    Requires that a job exists and is not already being printed.

Sign In or Register to comment.