SDK ทางการ
client แบบ typed บน REST API สำหรับห้าภาษาที่ถูกร้องขอมากที่สุด แต่ละตัวมาพร้อม bearer-token auth, exponential-backoff retry สำหรับ 429 และ 5xx และ helper verifyWebhookSignature สำหรับการตรวจสอบ HMAC-SHA256 ของ header X-Abundera-Signature สัญญาอนุญาต MIT
- TypeScript@abundera/qr-pronpmดู →
- Pythonabundera-qr-proPyPIดู →
- Gogithub.com/abundera/qr-pro-goGo modulesดู →
- Rubyabundera-qr-proRubyGemsดู →
- PHPabundera/qr-proPackagistดู →
TypeScript / Node
@abundera/qr-proNode 18+ ไม่มี runtime dependencies รองรับ ESM และ CJS
ติดตั้ง
npm install @abundera/qr-proสร้าง code
import { AbunderaQRProClient } from "@abundera/qr-pro";
const client = new AbunderaQRProClient({
apiKey: process.env.ABUNDERA_API_KEY!,
});
const code = await client.createCode({
destination_url: "https://example.com/launch",
label: "Spring launch poster",
});
console.log(code.short_url);ตรวจสอบ webhook
import { verifyWebhookSignature } from "@abundera/qr-pro";
verifyWebhookSignature({
signature: req.headers["x-abundera-signature"],
body: rawBody,
secret: process.env.ABUNDERA_WEBHOOK_SECRET!,
});
// throws on bad signature / skew, safe to parse body after this linePython
abundera-qr-proPython 3.9+ dependency เดียว (httpx) รองรับ sync และ async client
ติดตั้ง
pip install abundera-qr-proสร้าง code
from abundera_qr_pro import Client
with Client(api_key="abnd_qrpro_...") as c:
code = c.create_code(
destination_url="https://example.com/launch",
label="Spring launch poster",
)
print(code.short_url)ตรวจสอบ webhook
from abundera_qr_pro import verify_webhook_signature
from abundera_qr_pro.webhook import WebhookVerificationError
try:
verify_webhook_signature(
signature=request.headers["X-Abundera-Signature"],
body=request.body,
secret=os.environ["ABUNDERA_WEBHOOK_SECRET"],
)
except WebhookVerificationError:
return "", 400Go
github.com/abundera/qr-pro-goGo 1.21+ ใช้ standard library เท่านั้น รองรับ Context ตลอด
ติดตั้ง
go get github.com/abundera/qr-pro-goสร้าง code
import qrpro "github.com/abundera/qr-pro-go"
c, _ := qrpro.New(os.Getenv("ABUNDERA_API_KEY"))
ctx := context.Background()
code, err := c.CreateCode(ctx, qrpro.CodeCreate{
DestinationURL: "https://example.com/launch",
Label: "Spring launch poster",
})
if err != nil { log.Fatal(err) }
fmt.Println(code.ShortURL)ตรวจสอบ webhook
if err := qrpro.VerifyWebhookSignature(
r.Header.Get("X-Abundera-Signature"),
body,
os.Getenv("ABUNDERA_WEBHOOK_SECRET"),
0, // default 300s tolerance
); err != nil {
http.Error(w, "bad signature", http.StatusBadRequest)
return
}Ruby
abundera-qr-proRuby 3.0+ สร้างบน Faraday ทำงานร่วมกับ Rails initialiser ได้ดี
ติดตั้ง
gem install abundera-qr-pro
# or in Gemfile
gem "abundera-qr-pro"สร้าง code
require "abundera/qr_pro"
client = Abundera::QRPro::Client.new(api_key: ENV.fetch("ABUNDERA_API_KEY"))
code = client.create_code(
destination_url: "https://example.com/launch",
label: "Spring launch poster",
)
puts code.short_urlตรวจสอบ webhook
require "abundera/qr_pro/webhook"
begin
Abundera::QRPro::Webhook.verify!(
signature: request.headers["X-Abundera-Signature"],
body: request.raw_post,
secret: ENV.fetch("ABUNDERA_WEBHOOK_SECRET"),
)
rescue Abundera::QRPro::Webhook::InvalidSignature
head :bad_request
endPHP
abundera/qr-proPHP 8.1+ ทำงานกับ PSR-18 HTTP client ใด ๆ (Guzzle โดยค่าเริ่มต้น) service provider ของ Laravel และ Symfony อยู่ใน package เดิม
ติดตั้ง
composer require abundera/qr-proสร้าง code
use Abundera\QrPro\Client;
$client = new Client(apiKey: getenv('ABUNDERA_API_KEY'));
$code = $client->createCode(
destinationUrl: 'https://example.com/launch',
label: 'Spring launch poster',
);
echo $code->shortUrl;ตรวจสอบ webhook
use Abundera\QrPro\Webhook;
use Abundera\QrPro\WebhookException;
try {
Webhook::verify(
signature: $_SERVER['HTTP_X_ABUNDERA_SIGNATURE'] ?? '',
body: file_get_contents('php://input'),
secret: getenv('ABUNDERA_WEBHOOK_SECRET'),
);
} catch (WebhookException $e) {
http_response_code(400);
exit;
}สิ่งที่ทุก SDK ครอบคลุม
- Codes list, get, create, update, delete, ตรวจสอบ slug, import
- Analytics ส่งออก JSON และ CSV พร้อมตัวกรองวันที่
from/to - Groups list, create, delete, กำหนด code
- Webhooks list, create (พร้อม secret), delete รวมถึง helper ตรวจสอบลายเซ็น
- User
/me, ส่งออกบัญชี
endpoint ของ Admin, Stripe-webhook และโครงสร้างพื้นฐานไม่รวมใน SDK โดยเจตนา เป็นสำหรับบริการถึงบริการเท่านั้น รายการ endpoint ทั้งหมดอยู่ใน OpenAPI 3.1 spec
Postman collection
นำเข้าด้วยคลิกเดียวใน Postman หรือ Insomnia: /docs/postman.json (สร้างใหม่จาก OpenAPI spec ทุกครั้งที่ deploy) ทุกคำขอถูกกำหนดค่าล่วงหน้าด้วยเทมเพลต header bearer-token auth ตั้งค่า API key ครั้งเดียวในระดับ collection และทุก endpoint จะสืบทอดมัน
ต้องการ OpenAPI ดิบ? Postman รองรับ OpenAPI 3.1 โดยตรง: File → Import → Link จากนั้นวาง https://pro.qr.abundera.ai/docs/openapi.json
นโยบายการกำหนดเวอร์ชัน
SDK ทำตาม SemVer และกำหนดเวอร์ชันอิสระจาก API การแก้ไขข้อบกพร่อง SDK (0.1.0 → 0.1.1) ไม่เปลี่ยนเวอร์ชัน API การเปลี่ยน API แบบเพิ่มเติม (endpoint ใหม่, ฟิลด์ไม่บังคับใหม่) ไม่บังคับให้ SDK major bump
- SDK patch (
0.1.x) — แก้ไขข้อบกพร่อง, เอกสาร, ไม่เปลี่ยน public API อัปเดตอัตโนมัติได้ - SDK minor (
0.x.0) — method ใหม่สำหรับ API endpoint ใหม่ หรือการเพิ่มด้านการใช้งาน รองรับย้อนหลัง - SDK major (
1.0.0 → 2.0.0) — เปลี่ยนชื่อ นำออก เปลี่ยน type shape เฉพาะเมื่อ API major หรือเมื่อแก้ไขข้อบกพร่องด้านการใช้งาน SDK ที่มีมานานซึ่งไม่สามารถจัดส่งใน minor ได้
การกำหนดเวอร์ชัน API prefix URL คือเวอร์ชัน major วันนี้: /api/... (v1) การเปลี่ยนแปลงที่ทำให้เข้ากันไม่ได้จัดส่งเป็น /api/v2/... โดย v1 ยังใช้งานได้อย่างน้อย 12 เดือนและมี response header Deprecation + Sunset ตลอดหน้าต่าง deprecation คำนิยามเต็มของ "breaking" ที่ /docs/changelog/
หน้าต่างการสนับสนุน minor ล่าสุดบน major ปัจจุบันได้รับการแก้ไขความปลอดภัย major เก่ากว่าได้รับแพตช์ความปลอดภัยตามคำขอสำหรับลูกค้า Pro ที่ชำระเงิน
ตัวอย่างแอป
แอปที่รันได้ขั้นต่ำแสดงการสร้าง code การอัปเดตปลายทาง การอ่าน analytics และการตรวจสอบลายเซ็น webhook:
- node-express — TypeScript + Express, webhook endpoint with replay protection.
- fastapi — Python 3.11 + FastAPI, signature verification helper wired in.
- gin — Go 1.21 + Gin, idiomatic handler pattern.
- rails — Rails 7 + Sidekiq, webhook handler as a job.
- laravel — Laravel 11, signed-route webhook controller.
ตัวอย่างแต่ละรายการผ่านการทดสอบ CI กับ API จำลอง Clone, ตั้งค่า ABUNDERA_API_KEY และ ABUNDERA_WEBHOOK_SECRET, รัน
ไม่เห็นภาษาของคุณ?
The OpenAPI 3.1 spec is the source of truth. Generate a client in any language with openapi-generator, or write a thin wrapper yourself — the API is small (six core resources, bearer-token auth). If you’d like an official SDK for a language we don’t cover, email support@abundera.ai.