Decode QR Code
Decodes a base64-encoded image of a QR code to a UTF-8 string using the ZXing library.
Request
POST /nxt?requestType=decodeQRCode&qrCodeBase64=<base64>
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
qrCodeBase64 | string | Yes | Base64-encoded image of a QR code. Must be less than 200,000 bytes. |
Response
{
"qrCodeData": "Hello World"
}
Response Fields
| Field | Type | Description |
|---|---|---|
qrCodeData | string | Decoded UTF-8 string from the QR code. Empty string if QR code not found in image. |
Error Responses
| Condition | Response |
|---|---|
| Error reading base64 byte stream | Error response from JSONData.putException() |
| Invalid base64 image | Error response from JSONData.putException() |
Notes
- This endpoint does not require the blockchain to be running (
requireBlockchain = false). - Not chain-specific.
- Does not require admin password authentication (
requirePassword = false). - Uses ZXing library with
BarcodeFormat.QR_CODEand UTF-8 character set. - The output can be input to the Encode QR Code endpoint to recover the original data.
Source: DecodeQRCode.java.
Example
curl -X POST "http://localhost:22024/nxt" \
-d "requestType=decodeQRCode" \
-d "qrCodeBase64=/9j/4AAQSkZJRgABAQAAAQABAAA..."