Sign inSign up

justinbriard/qrcode

By justinbriard

•Updated over 2 years ago

An API to generate QRCode

Image
0

901

justinbriard/qrcode repository overview

⁠QRCode Generator

alt text

QRCode Generator is a REST API designed to generate QRCode.

This API is able to deviler the QRCode as an Base64 encoded PNG or directly as an image url.

⁠Installation

⁠Easy way

Use Docker

docker pull justinbriard/qrcode

⁠Start

⁠Environment Variables for S3

You need to setup some Environment Variable to run QRCode Generator in order to use bucket management. /!\ QRCOde Generator didn't manage the S3 storage, if you don't clean the bucket, the generated image will stay forever. I personaly use a Life Cycle rule to delete all the image older than 2 days.

S3BUCKET_URL="https://s3.fr-par.scw.cloud"
ACCESS_KEY="SCW4KFF46W"
SECRET_KEY="1ff11952-fed1-4a94-95e7-83fdb9a66367"
S3BUCKET_NAME="otbm-qrcode"
S3BUCKET_REGION="fr-par"
URL="https://api.qrcode.otbm.fr"

⁠Usage

Body Json

You need to send this body, if you omit any of the elements you will get an error.

{
"text":"hello World",
"size":"10",
"result_format":"base64"
}

You need to set this 3 elements :

  • text
  • size
  • result_format

text This is literraly the text you want to encode in the QRCode.

size It's the size of the generated image 1 is the smallest and 40 is the largest.

result_format Is the format is the format in which the image will be made available.

  • If set to base64, you will get the image encoded in base64
  • If set to link, you will get an URL to the generated image.

Endpoint v1/qrcode

Base64

curl --request POST \
  --url http://[server]:[port]/v1/elements \
  --header 'content-type: application/json' \
  --data '{
"text":"hello World",
"size":"10",
"result_format":"base64"
}'

result:

{
  "status": "ok",
  "result": "iVBORw0KGgoAAAANSUhEUgAAAEIAAABCAQAAAADLLz1FAAAAoklEQVR4nK3SMQrEMAxEUYFbQ64imNYwVzekDfgqBrUCbcgmZJVto+pVHyEkcU6XlyRl8SlMogEWWQpZUZ7q81/D7CFaGVfvkhRAJSuCled+lyYw+mRSYzO3SBr7BqMySbkYPKsYZ5es6u7tqNzCdPSjcksrTZkFXVcpkRQBI7Kk2AZlEm2/d40kRWvfyq/qagsfgs6RRYttY9ZeGM2z3v2hD7edgzQjGFQ7AAAAAElFTkSuQmCC"
}

Link

curl --request POST \
  --url http://[server]:[port]/v1/elements \
  --header 'content-type: application/json' \
  --data '{
"text":"hello World",
"size":"10",
"result_format":"link"
}'

result:

{
  "status": "ok",
  "result": "https://s3.fr-par.scw.cloud/otbm-qrcode/9KGB3KRG2MSCY6TY4L.png"
}

Endpoint /checkhealth

curl --request GET \
  --url http://[server]:[port]/checkhealth

result:

{
    "status": "ok"
}

Endpoint /version

curl --request GET \
  --url http://[server]:[port]/version

result:

1.4

⁠Demo

You can see more info on https://qrcode.otbm.fr/⁠ or test the API https://api.qrcode.otbm.fr⁠

⁠Project status

Under development

Tag summary

Content type

Image

Digest

sha256:4c9c8aaf4…

Size

64.8 MB

Last updated

over 2 years ago

docker pull justinbriard/qrcode