denix5655
-
Posts
3 -
Joined
-
Last visited
Content Type
Forums
Events
3D Prints
Posts posted by denix5655
-
-
Hi gr5,
I am doing my bachelors and i needed sometihng to work on, so I came up with this 🙂
- 1
-
Hi,
I am working on making a website where users upload theri gcode and then print from an avalible ultimker 3, with this code i managed to get the printer to work:
var url = "http://YOUR IP/api/v1/print_job";
var apiKey = "YOUR API KEY";
var apiSecret = "YOUR API SECRET";
var jobName = fileResponse.FileName;
var filePath = fileResponse.FullFilePath; //full file path to the fileusing var handler = new HttpClientHandler
{
Credentials = new NetworkCredential(apiKey, apiSecret)
};using var client = new HttpClient(handler);
using var fileStream = new FileStream(filePath, FileMode.Open);
using var content = new MultipartFormDataContent();
using var fileContent = new StreamContent(fileStream);fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
content.Add(fileContent, "file", jobName);var response = await client.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
}
I know that the post is old but I hope if anyone ever tries this again then it can come in handy.- 1
Using Digest Authentication with the Ultimaker Api in c#
in Firmware
Posted
That is a good idea 😄
If the API is similar to what Ultimaker has to offer then it should be relatively easy 😄
What languages do you code in?