QR 코드 API

Overview

The QR Code API is an HTTP API that can be use for creating custom QR Codes programmatically. Every QR Code will contain a unique Branch link which you can deep link and track analytics with.

📘

QR 코드 API

The QR Code API is available for enterprise customers. Please reach out to your Branch account team or submit a ticket to activate this feature.

Create a QR Code

엔드 포인트

POST /v1/qr-code
Content-Type: application/json

사용량 제한

  • 25 requests per second
  • 100 requests per minute
  • 1000 requests per hour

파라미터

파라미터

유형

정의

branch_key (REQUIRED)

String

The Branch key of the originating app; from your Branch Settings Dashboard

data (Optional)

JSON

The dictionary to embed link data behind the QR Code. Accessed as session or install parameters from the SDK. Use the data dictionary for all link control parameters that you'll find here.

Branch analytics parameters (Optional)

String

대시보드에서 데이터가 일관되고 읽기 쉽게 표시되도록 조직적인 분석 레이블 구조로 링크에 태그를 지정하는 것이 중요합니다.

qr_code_settings

JSON

If this nor any of the key/value pairs are not present, we will utilize your app defaults. See table below for setting details.

qr_code_settings

파라미터

유형

정의

code_color

String

Hex color value of the QR Code itself.

background_color

String

Hex color value of the background of the QR code itself.

margin

Integer (Pixels)

The number of pixels you want for the margin. Min 1px. Max 20px.

width

Integer (Pixels)

Output size of QR Code image. Min 300px. Max 2000px. (Only applicable to JPEG/PNG)

image_format

String

“JPEG”, “PNG”

center_logo_url

String (HTTP URL)

URL to the image you want as a center logo e.g. “https://cdn.branch.io/branch-assets/1598575682753-og_image.png”

샘플 요청

curl -X POST \
  https://api2.branch.io/v1/qr-code \
  -d '{
  "campaign": "qr_campaign",
  "channel": "flyer_1",
  "feature": "qr_codes",
  "data": {
    "$canonical_identifier": "content/123",
    "$og_title": "Title from Deep Link",
    "$og_description": "Description for QR code",
    "$og_image_url": "http://www.lorempixel.com/400/400/",
    "$canonical_url": "http://www.example.com/content/123",
    "custom_string": "anything"
  },
  "qr_code_settings": {
    "center_logo_url": "https://cdn.branch.io/branch-assets/1598575682753-og_image.png",
    "image_format": "png",
    "width": 512
  },
  "branch_key": "XXXXX_BRANCH_KEY_GOES_HERE_XXXXX"
}' --output qr_code.png

📘

Image Ouput

Note that the output of this cURL requests will be saved in the current directory as the file name indicated at the end of the request e.g. qr_code.png.

Result

512512

이 페이지가 도움이 되었습니까?