barcodes/templates/help.html

57 lines
2.0 KiB
HTML
Raw Permalink Normal View History

2023-09-03 20:52:51 +01:00
{{ define "title" }}API Documentation{{ end }}
2023-09-04 11:08:56 +01:00
{{ define "head" }}
{{ end }}
2023-09-03 20:52:51 +01:00
{{ define "body" }}
<p>For simple textual QR, Aztec or DataMatrix codes, a GET request can be made as follows:</p>
<code>/generate?type=[qr|aztec|datamatrix]&text=[YOUR_TEXT]</code>
<p>Dimensions will default to 300x300, and ECC level to 2.</p>
<p>This is also the format for URL barcodes</p>
<p>For other barcode types and custom options, API Requests can be made by making a POST request to /generate</p>
2023-09-01 22:47:46 +01:00
<p>The request body should be JSON similar to the below</p>
<pre>
<code>
{
"barcode_type": "code128",
"width": 600,
"height": 100,
"ecc_level": 4,
"content": "45684562"
}
</code>
</pre>
<p><code>barcode_type</code> should be one of:</p>
<ul>
{{range .BarcodeOptions}}
<li>{{.}}</li>
{{end}}
</ul>
2023-09-01 23:01:08 +01:00
<p><code>width</code> and <code>height</code> are in pixels - PDF417 is a fixed size and these options will only change the canvas size.</p>
2023-09-01 22:47:46 +01:00
<p><code>ecc_level</code> should be 1, 2, 3 or 4 where 1 is least resilient and 4 is most resilient</p>
2023-09-02 22:06:55 +01:00
<p><code>content</code> should be the value you wish the barcode to display. This should be a string and may not accept all characters - that is dependent on the barcode type.</p>
2023-09-01 22:47:46 +01:00
<p>The response will be a PNG image</p>
<h2>Formatted Barcodes</h2>
<p>Formatted barcodes are under development, this API endpoint <code>/generate/format</code> will produce a QR, Aztec or Datamatrix barcode with one of the following formats:</p>
<ul>
<li>WiFi Network</li>
<li>Contact (vCard)</li>
<li>Contact (MeCard)</li>
<li>Event (VCS)</li>
<li>Event (ICS)</li>
<li>Phone Number</li>
</ul>
<p>Note that URLs have no special formatting and can be produced as plain text barcodes using the <code>/generate</code> endpoint</p>
<p>This endpoint is not yet available</p>
2023-09-03 20:52:51 +01:00
{{ end }}