Skip to content

Commit eb4c273

Browse files
committed
deploy: d707613
1 parent 20151b7 commit eb4c273

File tree

1 file changed

+230
-9
lines changed

1 file changed

+230
-9
lines changed

index.html

Lines changed: 230 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@
404404
<li>
405405
<a href="#files" class="toc-h1 toc-link" data-title="Files">Files</a>
406406
<ul class="toc-list-h2">
407+
<li>
408+
<a href="#add-an-api-file-to-files" class="toc-h2 toc-link" data-title="Add an API File to files">Add an API File to files</a>
409+
</li>
407410
<li>
408411
<a href="#list-files-and-folders" class="toc-h2 toc-link" data-title="List Files and Folders">List Files and Folders</a>
409412
</li>
@@ -418,6 +421,14 @@
418421
</li>
419422
</ul>
420423
</li>
424+
<li>
425+
<a href="#api-files" class="toc-h1 toc-link" data-title="API Files">API Files</a>
426+
<ul class="toc-list-h2">
427+
<li>
428+
<a href="#upload-a-file-using-the-api" class="toc-h2 toc-link" data-title="Upload a file using the API">Upload a file using the API</a>
429+
</li>
430+
</ul>
431+
</li>
421432
<li>
422433
<a href="#queue" class="toc-h1 toc-link" data-title="Queue">Queue</a>
423434
<ul class="toc-list-h2">
@@ -1397,7 +1408,7 @@ <h2 id='start-print-create-job'>Start print / create job</h2><div class="highlig
13971408
</span><span class="p">}</span><span class="w">
13981409
</span></code></pre></div>
13991410
<aside class="notice">
1400-
You cannot upload new files via the API yet - only files from your file system or print queue can be printed via the API
1411+
You can only upload files through the API using <a href="#api-files">API Files</a>
14011412
</aside>
14021413

14031414
<p>This endpoint can be used to create a print job for one or more printers. The printers have to be in the <code>operational</code> state.</p>
@@ -1438,6 +1449,12 @@ <h3 id='request-2'>Request</h3>
14381449
<td>no</td>
14391450
<td>If true, the next queue item will be printed.<br><strong>This requires the Print Farm plan</strong></td>
14401451
</tr>
1452+
<tr>
1453+
<td><code>file_id</code></td>
1454+
<td>string</td>
1455+
<td>no</td>
1456+
<td>File ID from <a href="#api-files">API Files</a> - used to start a file without adding it as a queue item or user file.</td>
1457+
</tr>
14411458
</tbody></table>
14421459
<h4 id='extra-settings-for-next_queue_item'>Extra settings for <code>next_queue_item</code></h4>
14431460
<p>You can specify these parameters if <code>next_queue_item</code> is <code>true</code>. Note that you can specify more/all of the below parameters.</p>
@@ -2673,9 +2690,70 @@ <h3 id='response-5'>Response</h3>
26732690
</tbody></table>
26742691
<h1 id='files'>Files</h1>
26752692
<aside class="notice">
2676-
You cannot upload new files via the API yet - this is coming soon
2693+
You can only upload files through the API using <a href="#api-files">API Files</a>
26772694
</aside>
2678-
<h2 id='list-files-and-folders'>List Files and Folders</h2><div class="highlight"><pre class="highlight shell tab-shell"><code>curl https://api.simplyprint.io/<span class="o">{</span><span class="nb">id</span><span class="o">}</span>/files/GetFiles?f<span class="o">=</span>123&amp;search<span class="o">=</span>benchy <span class="se">\</span>
2695+
<h2 id='add-an-api-file-to-files'>Add an API File to files</h2>
2696+
<p><code>POST {id}/files/Upload?folder={folder}</code></p>
2697+
2698+
<table><thead>
2699+
<tr>
2700+
<th>Parameter</th>
2701+
<th>Type</th>
2702+
<th>Required</th>
2703+
<th>Description</th>
2704+
</tr>
2705+
</thead><tbody>
2706+
<tr>
2707+
<td><code>folder</code> (GET)</td>
2708+
<td>integer</td>
2709+
<td>no</td>
2710+
<td>Folder ID to get files for. <strong>Defaults to 0 (root folder)</strong></td>
2711+
</tr>
2712+
<tr>
2713+
<td><code>fileId</code> (POST)</td>
2714+
<td>string</td>
2715+
<td>yes</td>
2716+
<td>File ID from <a href="#api-files">API Files</a></td>
2717+
</tr>
2718+
</tbody></table>
2719+
<h3 id='response'>Response</h3>
2720+
<table><thead>
2721+
<tr>
2722+
<th>Parameter</th>
2723+
<th>Type</th>
2724+
<th>Description</th>
2725+
</tr>
2726+
</thead><tbody>
2727+
<tr>
2728+
<td><code>status</code></td>
2729+
<td>boolean</td>
2730+
<td>True if the request was successful.</td>
2731+
</tr>
2732+
<tr>
2733+
<td><code>message</code></td>
2734+
<td>string</td>
2735+
<td>Error message if <code>status</code> is false.</td>
2736+
</tr>
2737+
<tr>
2738+
<td><code>id</code></td>
2739+
<td>string</td>
2740+
<td>User file ID of newly added file</td>
2741+
</tr>
2742+
</tbody></table>
2743+
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST https://api.simplyprint.io/<span class="o">{</span><span class="nb">id</span><span class="o">}</span>/files/Upload?folder<span class="o">=</span>5290 <span class="se">\</span>
2744+
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
2745+
<span class="nt">-H</span> <span class="s1">'X-API-KEY: {API_KEY}'</span> <span class="se">\</span>
2746+
<span class="nt">-F</span> <span class="s1">'fileId=43aaad56548c959f655d0524027b726a7514493ec8436f4942f876bb07eab731'</span>
2747+
</code></pre></div>
2748+
<blockquote>
2749+
<p>Success Response</p>
2750+
</blockquote>
2751+
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
2752+
</span><span class="nl">"status"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w">
2753+
</span><span class="nl">"message"</span><span class="p">:</span><span class="kc">null</span><span class="p">,</span><span class="w">
2754+
</span><span class="nl">"id"</span><span class="p">:</span><span class="s2">"6f7d79212f384c6b8eae2811c37d9338"</span><span class="w">
2755+
</span><span class="p">}</span><span class="w">
2756+
</span></code></pre></div><h2 id='list-files-and-folders'>List Files and Folders</h2><div class="highlight"><pre class="highlight shell tab-shell"><code>curl https://api.simplyprint.io/<span class="o">{</span><span class="nb">id</span><span class="o">}</span>/files/GetFiles?f<span class="o">=</span>123&amp;search<span class="o">=</span>benchy <span class="se">\</span>
26792757
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
26802758
<span class="nt">-H</span> <span class="s1">'X-API-KEY: {API_KEY}'</span>
26812759
</code></pre></div>
@@ -2836,7 +2914,7 @@ <h3 id='request'>Request</h3>
28362914
<td>For print cost calculation, if you want the files to use the material of a printer, request with the ID of the printer - don&#39;t include the <code>pid</code> argument otherwise</td>
28372915
</tr>
28382916
</tbody></table>
2839-
<h3 id='response'>Response</h3>
2917+
<h3 id='response-2'>Response</h3>
28402918
<table><thead>
28412919
<tr>
28422920
<th>Parameter</th>
@@ -2922,7 +3000,7 @@ <h3 id='request-2'>Request</h3>
29223000
<td>Folder ID to move files to.</td>
29233001
</tr>
29243002
</tbody></table>
2925-
<h3 id='response-2'>Response</h3>
3003+
<h3 id='response-3'>Response</h3>
29263004
<table><thead>
29273005
<tr>
29283006
<th>Parameter</th>
@@ -2989,7 +3067,7 @@ <h3 id='request-3'>Request</h3>
29893067
<td>Folder ID to get details for.</td>
29903068
</tr>
29913069
</tbody></table>
2992-
<h3 id='response-3'>Response</h3>
3070+
<h3 id='response-4'>Response</h3>
29933071
<table><thead>
29943072
<tr>
29953073
<th>Parameter</th>
@@ -3088,7 +3166,7 @@ <h3 id='request-4'>Request</h3>
30883166
<td>Folder ID to move to.</td>
30893167
</tr>
30903168
</tbody></table>
3091-
<h3 id='response-4'>Response</h3>
3169+
<h3 id='response-5'>Response</h3>
30923170
<table><thead>
30933171
<tr>
30943172
<th>Parameter</th>
@@ -3107,6 +3185,143 @@ <h3 id='response-4'>Response</h3>
31073185
<td>Success message or error message if <code>status</code> is false.</td>
31083186
</tr>
31093187
</tbody></table>
3188+
<h1 id='api-files'>API Files</h1>
3189+
<p>The base URL for the SimplyPrint Files API is <code>https://files.simplyprint.io/{id}/</code>. Use the exact same authentication as the normal api endpoint. It is very important you ensure you send files with the correct file extension. The API will not be able to determine the file type based on the content.</p>
3190+
<h2 id='upload-a-file-using-the-api'>Upload a file using the API</h2>
3191+
<p><code>POST {id}/files/Upload</code></p>
3192+
3193+
<blockquote>
3194+
<p>Example request to upload a file less than 100MB</p>
3195+
</blockquote>
3196+
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://files.simplyprint.io/{id}/files/Upload"</span> <span class="se">\</span>
3197+
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
3198+
<span class="nt">-H</span> <span class="s2">"X-API-KEY: {API_KEY}"</span> <span class="se">\</span>
3199+
<span class="nt">-F</span> <span class="s2">"file=@/path/to/file.gcode"</span>
3200+
</code></pre></div>
3201+
<blockquote>
3202+
<p>Success response</p>
3203+
</blockquote>
3204+
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
3205+
</span><span class="nl">"status"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w">
3206+
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
3207+
</span><span class="nl">"file"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
3208+
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd"</span><span class="p">,</span><span class="w">
3209+
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"file.gcode"</span><span class="p">,</span><span class="w">
3210+
</span><span class="nl">"size"</span><span class="p">:</span><span class="w"> </span><span class="mi">13439</span><span class="w">
3211+
</span><span class="p">}</span><span class="w">
3212+
</span><span class="p">}</span><span class="w">
3213+
</span></code></pre></div>
3214+
<blockquote>
3215+
<p>Multiple parts for a single file larger than 100MB. The first filename is the filename of the entire file.</p>
3216+
</blockquote>
3217+
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://files.simplyprint.io/{id}/files/Upload"</span> <span class="se">\</span>
3218+
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
3219+
<span class="nt">-H</span> <span class="s2">"X-API-KEY: {API_KEY}"</span> <span class="se">\</span>
3220+
<span class="nt">-F</span> <span class="s2">"file=@/path/to/part1.3mf"</span>
3221+
<span class="nt">-F</span> <span class="s2">"totalSize=3352316"</span>
3222+
</code></pre></div>
3223+
<blockquote>
3224+
<p>Success response with continueToken</p>
3225+
</blockquote>
3226+
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
3227+
</span><span class="nl">"status"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w">
3228+
</span><span class="nl">"message"</span><span class="p">:</span><span class="kc">null</span><span class="p">,</span><span class="w">
3229+
</span><span class="nl">"continueToken"</span><span class="p">:</span><span class="w"> </span><span class="s2">"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJ0eXBlIjoiYWN0ao9uX3Rva2VuIiwiYWN0aW9uIjoiZmlsZV9jb250aW51ZV91cGxvYWQiLCJ1c2VyIjo2OTc2LCJjb21wYW55IjoyLCJkYXRhIja7ImJ1Y2tldEhhc2giOiI0MGQ2MzgwNmQwYWUxODhkNjc5YzY0NjA0M2RiYjUxMTc0NTViNTc1NjNlODEzZDc2MGRjMTJkMzVaYjdmY2Y0IiwidG90YWxTaXplIjoxNjc2MTU4NH0sImlhdCI6MTcyNTU2MjEzMywiZXhwIjoxNzI1NjQ4NTMzfQ.9qyNyx9A4Ox_6GrFSxXpxlpLcAKaSr8ln84X3yuWdhT_2O3L8-lGWaXAbQk9VvR-3pu1-a9p40amnt6Fghy49InjzCfNMRp-6-Ft_uMRf6PbmcCCrksvRxNP38ImoXy6"</span><span class="w">
3230+
</span><span class="p">}</span><span class="w">
3231+
</span></code></pre></div>
3232+
<blockquote>
3233+
<p>Continue uploading the file (send next part with only the continueToken)</p>
3234+
</blockquote>
3235+
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://files.simplyprint.io/{id}/files/Upload"</span> <span class="se">\</span>
3236+
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
3237+
<span class="nt">-H</span> <span class="s2">"X-API-KEY: {API_KEY}"</span> <span class="se">\</span>
3238+
<span class="nt">-F</span> <span class="s2">"continueToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJ0eXBlIjoiYWN0ao9uX3Rva2VuIiwiYWN0aW9uIjoiZmlsZV9jb250aW51ZV91cGxvYWQiLCJ1c2VyIjo2OTc2LCJjb21wYW55IjoyLCJkYXRhIja7ImJ1Y2tldEhhc2giOiI0MGQ2MzgwNmQwYWUxODhkNjc5YzY0NjA0M2RiYjUxMTc0NTViNTc1NjNlODEzZDc2MGRjMTJkMzVaYjdmY2Y0IiwidG90YWxTaXplIjoxNjc2MTU4NH0sImlhdCI6MTcyNTU2MjEzMywiZXhwIjoxNzI1NjQ4NTMzfQ.9qyNyx9A4Ox_6GrFSxXpxlpLcAKaSr8ln84X3yuWdhT_2O3L8-lGWaXAbQk9VvR-3pu1-a9p40amnt6Fghy49InjzCfNMRp-6-Ft_uMRf6PbmcCCrksvRxNP38ImoXy6"</span> <span class="se">\</span>
3239+
<span class="nt">-F</span> <span class="s2">"file=@/path/to/part2.3mf"</span>
3240+
</code></pre></div>
3241+
<blockquote>
3242+
<p>Sucessful final response as we ensured to only send exactly the total size of the file.</p>
3243+
</blockquote>
3244+
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
3245+
</span><span class="nl">"status"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w">
3246+
</span><span class="nl">"message"</span><span class="p">:</span><span class="kc">null</span><span class="p">,</span><span class="w">
3247+
</span><span class="nl">"file"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
3248+
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd"</span><span class="p">,</span><span class="w">
3249+
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"part1.3mf"</span><span class="p">,</span><span class="w">
3250+
</span><span class="nl">"size"</span><span class="p">:</span><span class="w"> </span><span class="mi">3352316</span><span class="w">
3251+
</span><span class="p">}</span><span class="w">
3252+
</span><span class="p">}</span><span class="w">
3253+
</span></code></pre></div><h3 id='request'>Request</h3>
3254+
<table><thead>
3255+
<tr>
3256+
<th>Parameter</th>
3257+
<th>Type</th>
3258+
<th>Required</th>
3259+
<th>Description</th>
3260+
</tr>
3261+
</thead><tbody>
3262+
<tr>
3263+
<td><code>file</code></td>
3264+
<td>file</td>
3265+
<td>yes</td>
3266+
<td>Uploaded file (Max 100mb)</td>
3267+
</tr>
3268+
<tr>
3269+
<td><code>continueToken</code></td>
3270+
<td>string</td>
3271+
<td>no</td>
3272+
<td>Optional token you&#39;ll get if you need to continue the upload for files greater than 100MB.</td>
3273+
</tr>
3274+
<tr>
3275+
<td><code>totalSize</code></td>
3276+
<td>integer</td>
3277+
<td>no</td>
3278+
<td>Send this if you want a continueToken, by providing the total size of the entire file you want to upload</td>
3279+
</tr>
3280+
</tbody></table>
3281+
<h3 id='response'>Response</h3>
3282+
<table><thead>
3283+
<tr>
3284+
<th>Parameter</th>
3285+
<th>Type</th>
3286+
<th>Description</th>
3287+
</tr>
3288+
</thead><tbody>
3289+
<tr>
3290+
<td><code>status</code></td>
3291+
<td>boolean</td>
3292+
<td>True if the request was successful.</td>
3293+
</tr>
3294+
<tr>
3295+
<td><code>message</code></td>
3296+
<td>string</td>
3297+
<td>Error message if <code>status</code> is false.</td>
3298+
</tr>
3299+
<tr>
3300+
<td><code>continueToken</code></td>
3301+
<td>string</td>
3302+
<td>For every subsequent request that still has some pending size based on the total size this will be returned instead of the file.</td>
3303+
</tr>
3304+
<tr>
3305+
<td><code>file.*</code></td>
3306+
<td>object</td>
3307+
<td>Final file object after entire file has been uploaded</td>
3308+
</tr>
3309+
<tr>
3310+
<td><code>file.id</code></td>
3311+
<td>string</td>
3312+
<td>The API File ID you&#39;ll need to use other SimplyPrint APIs</td>
3313+
</tr>
3314+
<tr>
3315+
<td><code>file.name</code></td>
3316+
<td>string</td>
3317+
<td>Name used to reference the file</td>
3318+
</tr>
3319+
<tr>
3320+
<td><code>file.size</code></td>
3321+
<td>int</td>
3322+
<td>Total size of uploaded file</td>
3323+
</tr>
3324+
</tbody></table>
31103325
<h1 id='queue'>Queue</h1><h2 id='add-item-to-queue'>Add item to queue</h2><div class="highlight"><pre class="highlight shell tab-shell"><code>curl https://api.simplyprint.io/<span class="o">{</span><span class="nb">id</span><span class="o">}</span>/queue/AddItem <span class="se">\</span>
31113326
<span class="nt">-X</span> POST <span class="se">\</span>
31123327
<span class="nt">-H</span> <span class="s1">'accept: application/json'</span> <span class="se">\</span>
@@ -3135,7 +3350,7 @@ <h1 id='queue'>Queue</h1><h2 id='add-item-to-queue'>Add item to queue</h2><div c
31353350
</aside>
31363351

31373352
<aside class="notice">
3138-
You cannot upload new files via the API yet - this is coming soon
3353+
You can only upload files through the API using <a href="#api-files">API Files</a>
31393354
</aside>
31403355

31413356
<p>This endpoint adds a file to the queue. The file can either be a file on the filesystem or an uploaded stl/3mf/obj/gcode/gco/nc/npg file.</p>
@@ -3156,7 +3371,7 @@ <h3 id='request'>Request</h3>
31563371
<td><code>filesystem</code></td>
31573372
<td>string</td>
31583373
<td>no</td>
3159-
<td>The filesystem id of the file to add to the queue.</td>
3374+
<td>The <a href="#files">filesystem</a> id of the file to add to the queue.</td>
31603375
</tr>
31613376
<tr>
31623377
<td><code>amount</code></td>
@@ -3170,6 +3385,12 @@ <h3 id='request'>Request</h3>
31703385
<td>no</td>
31713386
<td>If you have Queue Groups - ID of the group the item should be added to.<br><strong>Default: 0 - required if you have Queue Groups</strong></td>
31723387
</tr>
3388+
<tr>
3389+
<td><code>fileId</code></td>
3390+
<td>string</td>
3391+
<td>no</td>
3392+
<td>Optional File ID from <a href="#api-files">API File</a> - use this to add a file uploaded via the API.</td>
3393+
</tr>
31733394
</tbody></table>
31743395
<h3 id='response'>Response</h3>
31753396
<table><thead>

0 commit comments

Comments
 (0)