Starting a job via Web-API

Hello Repetier

I'm currently working on integrating RepetierServer API into my project, and I've encountered some difficulties when attempting to upload and start a new print job using the API. I have reviewed the documentation, but I'm still unclear about the correct procedure and parameters required for this.

Based on the documentation, I'm using the following endpoint for the POST request: POST http://localhost:3344/printer/job/<slug>?a=upload&autostart=<autostart>&name=<NewName>&sess=<session key>

However, I'm unsure about the exact process and how to include the g-code file content in the "filename" field. I'm working in a Vue.js environment, and I'd like to achieve this on the client-side if possible.

I would greatly appreciate it if someone could provide me with a clear explanation or an example code/pseudocode snippet demonstrating the correct procedure for uploading and starting a new print., and if I'm reading the server logs correctly, it seems like my problem has to do with the payload of my request.

Thank you in advance for your time and assistance.



Comments

  • Sending it needs you to use multipart encoding to include a file with form field "filename" as well. Also you need a valid active session or use apikey=<key> instead if you don't have a open session. Doing this from javascript is no problem with axios or new fetch api fro javascript. You will find lots of examples for this. It is just sending a form with file and the parameter you already now if you want upload and start print.
  • Thanks for the response, with regards to the gcode file, am I to  send a local file from the client side or identify a file that is already uploaded to repetier server?
  • The sample you posted is for uploading and optionally start if no print is running.

    If you check the websocket api in api documentation you will see that you can also query stored gcodes and start them, but these require different api calls. In general all our gui only use this api so anything you do there can be achieved. If in doubt check browser network and websocket communication on the commands issued to do so. Anything involving file uploads/downloads use a simple api call. All actions with only a bit of data uses the much faster websocket solution which is also used to deliver events to keep your interface up to date.
Sign In or Register to comment.