api

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 27 Imported by: 0

README

QR Code API

Encoding

Request:

GET /encode?content=helloWorld&size=400&type=png

Params:

  • content required
  • size QR Code size in pixel, may not be honored
  • type png(default) or string

Response:

  • HTTP status 200 OK

A image/png or plain text(type=string).

  • HTTP status 400 Bad Request

Check your params.

  • HTTP status 500

Something unexpected happened.

Decoding

Request:

POST /decode

Params: image as binary body

Response:

  • HTTP status 200 OK

Good decoding:

{
    "ok": true,
    "desc": "",
    "content": [
        "你好"
    ]
}

Everything is ok, but nothing recognized:

{
    "ok": true,
    "desc": "",
    "content": null
}

Something is wrong:

{
    "ok": false,
    "desc": "file decoding error: image: unknown format",
    "content": null
}
  • HTTP status 413 Request Entity Too Large

Request Body is too large.

  • HTTP status 500

Something unexpected happened.

Build

You need have Zbar library installed, whose details can be found at README.md in project root.

./build.sh

Run

cp config_example.toml config.toml
# after editing config.toml per your need
./run.sh

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL