|
301 | 301 | <script defer data-domain="apidocs.simplyprint.io" src="https://plausible.io/js/plausible.js"></script>
|
302 | 302 | </head>
|
303 | 303 |
|
304 |
| - <body class="index" data-languages="["shell","php"]"> |
| 304 | + <body class="index" data-languages="["shell","python"]"> |
305 | 305 | <a href="#" id="nav-button">
|
306 | 306 | <span>
|
307 | 307 | NAV
|
|
312 | 312 | <img src="images/logo-d4a096f7.png?v=2" class="logo" alt="" />
|
313 | 313 | <div class="lang-selector">
|
314 | 314 | <a href="#" data-language-name="shell">cURL</a>
|
315 |
| - <a href="#" data-language-name="php">PHP</a> |
| 315 | + <a href="#" data-language-name="python">Python 3</a> |
316 | 316 | </div>
|
317 | 317 | <div class="search">
|
318 | 318 | <input type="text" class="search" id="input-search" placeholder="Search">
|
319 | 319 | </div>
|
320 | 320 | <ul class="search-results"></ul>
|
321 | 321 | <ul id="toc" class="toc-list-h1">
|
322 | 322 | <li>
|
323 |
| - <a href="#introduction" class="toc-h1 toc-link" data-title="Introduction">Introduction</a> |
324 |
| - </li> |
325 |
| - <li> |
326 |
| - <a href="#authentication" class="toc-h1 toc-link" data-title="Authentication">Authentication</a> |
| 323 | + <a href="#getting-started" class="toc-h1 toc-link" data-title="Getting Started">Getting Started</a> |
| 324 | + <ul class="toc-list-h2"> |
| 325 | + <li> |
| 326 | + <a href="#getting-an-api-key" class="toc-h2 toc-link" data-title="Getting an API key">Getting an API key</a> |
| 327 | + </li> |
| 328 | + <li> |
| 329 | + <a href="#the-base-url" class="toc-h2 toc-link" data-title="The base URL">The base URL</a> |
| 330 | + </li> |
| 331 | + <li> |
| 332 | + <a href="#test-your-api-key" class="toc-h2 toc-link" data-title="Test your API key">Test your API key</a> |
| 333 | + </li> |
| 334 | + </ul> |
327 | 335 | </li>
|
328 | 336 | <li>
|
329 | 337 | <a href="#printers" class="toc-h1 toc-link" data-title="Printers">Printers</a>
|
|
338 | 346 | </li>
|
339 | 347 | <li>
|
340 | 348 | <a href="#errors" class="toc-h1 toc-link" data-title="Errors">Errors</a>
|
| 349 | + <ul class="toc-list-h2"> |
| 350 | + <li> |
| 351 | + <a href="#error-response" class="toc-h2 toc-link" data-title="Error Response">Error Response</a> |
| 352 | + </li> |
| 353 | + </ul> |
341 | 354 | </li>
|
342 | 355 | </ul>
|
343 | 356 | <ul class="toc-footer">
|
344 |
| - <li><a href='#'>Sign Up for a Developer Key <i>(coming soon)</i></a></li> |
| 357 | + <li><a href='https://simplyprint.io' target='_blank'>SimplyPrint</a></li> |
345 | 358 | </ul>
|
346 | 359 | </div>
|
347 | 360 | <div class="page-wrapper">
|
348 | 361 | <div class="dark-box"></div>
|
349 | 362 | <div class="content">
|
350 |
| - <h1 id='introduction'>Introduction</h1> |
351 |
| -<p><strong>The SimplyPrint API is under construction!</strong> |
352 |
| -This means this site contains no real documentation yet, but it will soon.</p> |
353 |
| -<h1 id='authentication'>Authentication</h1> |
| 363 | + <h1 id='getting-started'>Getting Started</h1> |
| 364 | +<aside class="notice"> |
| 365 | + <b>The SimplyPrint API is under construction!</b> |
| 366 | + |
| 367 | + This means this site contains no real documentation yet, but it will soon. |
| 368 | +</aside> |
| 369 | + |
| 370 | +<p>Welcome to the <strong>SimplyPrint API</strong>!</p> |
| 371 | + |
| 372 | +<p>This documentation goes through authenticating and how to use the API. To get started you'll need an API key.</p> |
| 373 | +<h2 id='getting-an-api-key'>Getting an API key</h2> |
| 374 | +<p>To get an API key you'll need a SimplyPrint account that is either a member of an organization or has at least the <a href="https://simplyprint.io/#pricing">SimplyPrint Pro plan</a>.</p> |
| 375 | + |
| 376 | +<p>To create your own API key you first need a SimplyPrint account, you can go to your <a href="https://simplyprint.io/account/settings">account settings</a> and create a new API key.</p> |
| 377 | + |
| 378 | +<p>TODO; Create API key page and explain how to create an API key.</p> |
| 379 | +<h2 id='the-base-url'>The base URL</h2> |
| 380 | +<p>The base URL for the SimplyPrint API is <code>https://api.simplyprint.io/{id}/</code>.</p> |
| 381 | + |
| 382 | +<p>To use the base API at <a href="https://api.simplyprint.io">https://api.simplyprint.io</a>, you will need to specify an id.</p> |
| 383 | + |
| 384 | +<p>The id represents the unique identifier for the company that you are using the API key for. This id is used to access the specific functionality within the API that is associated with the company.</p> |
| 385 | + |
| 386 | +<p>The endpoint represents the specific functionality that you want to access within the API. There are various endpoints available, each with its own specific purpose and functionality.</p> |
| 387 | + |
| 388 | +<p>For example, if you want to access the <code>account/Test</code> endpoint for a company with an id of 123, you would use the following API endpoint:</p> |
| 389 | + |
| 390 | +<p><a href="https://api.simplyprint.io/123/account/Test">https://api.simplyprint.io/123/account/Test</a></p> |
| 391 | + |
| 392 | +<p>If you are part of an organization, you might need to ask your organization administrator to allow API access for your account for the organization.</p> |
| 393 | + |
| 394 | +<aside class="notice"> |
| 395 | + <b>For the rest of this documentation, we will use the following variables:</b> |
| 396 | + |
| 397 | + <ol> |
| 398 | + <li>Replace <code>{base_url}</code> with your base api url</li> |
| 399 | + <li>Replace <code>{API_KEY}</code> with your API key</li> |
| 400 | + </ol> |
| 401 | +</aside> |
| 402 | +<h2 id='test-your-api-key'>Test your API key</h2><div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="o">{</span>base_url<span class="o">}</span>/account/Test <span class="se">\</span> |
| 403 | + <span class="nt">--header</span> <span class="s1">'X-API-KEY: {API_KEY}'</span> |
| 404 | +</code></pre></div><div class="highlight"><pre class="highlight python tab-python"><code><span class="kn">import</span> <span class="nn">requests</span> |
| 405 | + |
| 406 | +<span class="n">url</span> <span class="o">=</span> <span class="s">"{base_url}/account/Test"</span> |
| 407 | + |
| 408 | +<span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s">'X-API-KEY'</span><span class="p">:</span> <span class="s">'{API_KEY}'</span><span class="p">})</span> |
| 409 | + |
| 410 | +<span class="k">print</span><span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">json</span><span class="p">())</span> |
| 411 | +</code></pre></div> |
354 | 412 | <blockquote>
|
355 |
| -<p>To authorize, use this code:</p> |
| 413 | +<p>Success return:</p> |
356 | 414 | </blockquote>
|
357 |
| -<div class="highlight"><pre class="highlight php tab-php"><code><span class="cp"><?php</span> |
358 |
| -<span class="c1">//Coming soon...</span> |
359 |
| -<span class="cp">?></span> |
360 |
| -</code></pre></div> |
361 |
| -<p>Coming soon...</p> |
| 415 | +<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> |
| 416 | + </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> |
| 417 | + </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Your API key is valid!"</span><span class="w"> |
| 418 | +</span><span class="p">}</span><span class="w"> |
| 419 | +</span></code></pre></div> |
| 420 | +<blockquote> |
| 421 | +<p>Error return in case of an invalid or missing API key:</p> |
| 422 | +</blockquote> |
| 423 | +<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> |
| 424 | + </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"> |
| 425 | + </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"No API key provided, or not logged in"</span><span class="w"> |
| 426 | +</span><span class="p">}</span><span class="w"> |
| 427 | +</span></code></pre></div> |
| 428 | +<blockquote> |
| 429 | +<p>Error return in case of missing permissions for the organization:</p> |
| 430 | +</blockquote> |
| 431 | +<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> |
| 432 | + </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"> |
| 433 | + </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"You don't have access to this account"</span><span class="w"> |
| 434 | +</span><span class="p">}</span><span class="w"> |
| 435 | +</span></code></pre></div> |
| 436 | +<p>To verify that your API key is valid and that you have access to the desired organization, you can make a request to the <code>/account/Test</code> endpoint.</p> |
| 437 | + |
| 438 | +<p>To make any request to the SimplyPrint API, you will need to include your API key in the request header. You can do this by including the <code>X-API-KEY</code> header in your request. On the right side of this page, you can see an example of how to make a request to the <code>/account/Test</code> endpoint using cURL and Python.</p> |
| 439 | + |
| 440 | +<p>If you are unable to successfully make a request to the <code>/account/Test</code> endpoint using the provided example, there may be a few possible issues:</p> |
| 441 | + |
| 442 | +<ul> |
| 443 | +<li>Your API key may be invalid or missing. Make sure that you have a valid API key and that you are including it in the request header as shown in the example.</li> |
| 444 | +<li>You may not have access to the organization specified in the <code>id</code> parameter. Make sure that you are using the correct <code>id</code> for the organization that you have access to.</li> |
| 445 | +<li>There may be a problem with the base API URL or endpoint. Double check that you are using the correct base API URL and endpoint in your request.</li> |
| 446 | +</ul> |
| 447 | + |
| 448 | +<p>If you are unable to resolve the issue after troubleshooting these potential issues, you may need to contact your organization administrator for further assistance. Otherwise, feel free to contact us via our <a href="https://help.simplyprint.io/">helpdesk</a>.</p> |
362 | 449 | <h1 id='printers'>Printers</h1><h2 id='get-printer-s'>Get printer(s)</h2><div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">--request</span> GET <span class="se">\</span>
|
363 | 450 | <span class="nt">--url</span> http://api.simplyprint.io/v1/actions/printers/get <span class="se">\</span>
|
364 | 451 | <span class="nt">--header</span> <span class="s1">'Authorization: Bearer {YOUR_TOKEN_HERE}'</span>
|
@@ -454,7 +541,7 @@ <h3 id='query-parameters-2'>Query Parameters</h3>
|
454 | 541 | </tr>
|
455 | 542 | </tbody></table>
|
456 | 543 | <h1 id='errors'>Errors</h1>
|
457 |
| -<p>The SimplyPrint API uses the following error codes:</p> |
| 544 | +<p>The SimplyPrint API uses the following HTTP error codes:</p> |
458 | 545 |
|
459 | 546 | <table><thead>
|
460 | 547 | <tr>
|
@@ -502,13 +589,42 @@ <h1 id='errors'>Errors</h1>
|
502 | 589 | <td>503</td>
|
503 | 590 | <td>Service Unavailable -- We're temporarily offline for maintenance. Please try again later.</td>
|
504 | 591 | </tr>
|
| 592 | +</tbody></table> |
| 593 | +<h2 id='error-response'>Error Response</h2> |
| 594 | +<blockquote> |
| 595 | +<p>Error response example:</p> |
| 596 | +</blockquote> |
| 597 | +<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> |
| 598 | + </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"> |
| 599 | + </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"No API key provided, or not logged in"</span><span class="w"> |
| 600 | +</span><span class="p">}</span><span class="w"> |
| 601 | +</span></code></pre></div> |
| 602 | +<p>When an error occurs, the API will return a JSON object with the following fields:</p> |
| 603 | + |
| 604 | +<table><thead> |
| 605 | +<tr> |
| 606 | +<th>Field</th> |
| 607 | +<th>Description</th> |
| 608 | +<th>Type</th> |
| 609 | +</tr> |
| 610 | +</thead><tbody> |
| 611 | +<tr> |
| 612 | +<td>status</td> |
| 613 | +<td>The status of the request</td> |
| 614 | +<td>Boolean</td> |
| 615 | +</tr> |
| 616 | +<tr> |
| 617 | +<td>message</td> |
| 618 | +<td>A message describing the error</td> |
| 619 | +<td>String</td> |
| 620 | +</tr> |
505 | 621 | </tbody></table>
|
506 | 622 |
|
507 | 623 | </div>
|
508 | 624 | <div class="dark-box">
|
509 | 625 | <div class="lang-selector">
|
510 | 626 | <a href="#" data-language-name="shell">cURL</a>
|
511 |
| - <a href="#" data-language-name="php">PHP</a> |
| 627 | + <a href="#" data-language-name="python">Python 3</a> |
512 | 628 | </div>
|
513 | 629 | </div>
|
514 | 630 | </div>
|
|
0 commit comments