Git Product home page Git Product logo

qrcode-api's Introduction

QR Code API

Go Report Card GoDoc Docker Image

A simple API service for QR Code generation/recognition.

This project provide Bearychat integration.

API Doc

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.

Docker Image

There is a pre-compiled Docker image alone with C++ dependencies(ZBar), you may pull the image like following:

docker pull nanmu42/qrcode-api

See Docker directory for docker-compose.yaml and more detail.

Build and Run

If you'd like to get you hands dirty, you can build this project as following:

Download and compile ZBar for shared dependencies:

wget https://downloads.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.bz2
# or, if you are suffering decoding troubles on UTF-8, try this modified version:
# wget https://github.com/nanmu42/zbar-utf8/archive/master.zip
tar -xf zbar-0.10.tar.bz2
cd zbar-0.10
export CFLAGS=""
./configure --disable-video --without-imagemagick --without-qt --without-python --without-gtk --without-x --disable-pthread
make install

Go to cmd/api or cmd/bearychat for further instruction, more details are in README.md there.

License

Copyright (c) 2018 LI Zhennan

Use of this work is governed by an MIT License. You may find a license copy in project root.

qrcode-api's People

Contributors

nanmu42 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.