Send G-code file to Octoprint from a C program

I have plenty of programming experience, but unfortunately none in web stuff at all.. so I'm trying to get pointer on where to start. I have a C program on Windows that wants to queue a G-code file to Octoprint on a remote server, and (optionally) to get status back at intervals during printing. Any snippets or pointers to how to send API requests, preferably without requiring any other installed software, would be great to see.

Hi
This might help you :slight_smile:
https://docs.octoprint.org/en/master/index.html

haha very funny.
Did see this: Possible to upload and start printing thru web
and was hoping for a bit less reliance on external commands, but it's a start.

Unless someone writes a library or something you can pull in, that does the API commands for you, then the API section of the docs are your friend. I don't know of anyone who has, and I only know of one Python wrapper of OctoPrint's API specifically.

I do know that for Python there is the requests library, that makes API requests very easy, so maybe you could look for something like that for C that you could use?

This might be fruitful:


I'll work something up and post it here if it works.

Why don't you use the REST API Octoprint offers?
It's good technik and you don't have to write all the basic code handling the protocol. There are lots of libraries you can use. Low level talking direct over WinSock and also some for .net.

Have done it along the lines of the stackoverflow post (although using winsock calls) but found it needed the Content-Length field on the multipart form.