🔧 توثيق واجهة البرمجة

أنشئ رموزاً بلا حدود عبر الـ API

ربط بسيط عبر HTTP — ادمج إنشاء QR والباركود في Excel، Google Sheets، أي ERP، أو حتى زر واحد في متصفحك. كل ما تحتاجه هو مفتاحك وبياناتك.

🚀 بداية سريعة

GET https://ultdtc.com/api?api_key=YOUR_KEY&data=Hello+World&type=qr&transparent=1&output=image

الاستجابة: صورة PNG شفافة مباشرة — يمكنك استخدامها في <img src="..."> أو حفظها مباشرة.

🔑 المصادقة

أضف api_key إلى كل طلب. يمكنك الحصول على مفتاحك من لوحة التحكم تحت قسم Developer API (يتطلب باقة Unlimited).

سجّل الدخول للحصول على مفتاحك →

📋 المعاملات

المعامل القيمة الافتراضية الوصف
api_key * required مفتاح API السري — مطلوب في كل طلب
data * required النص أو الرابط أو قيمة الباركود المراد تشفيره
type qr qr أو barcode
color 000000 لون الخط بصيغة HEX بدون # (مثال: 1a1aff)
transparent 1 1 = خلفية شفافة (افتراضي)، 0 = خلفية ملونة
bg_color ffffff لون الخلفية HEX — يُستخدم فقط عندما transparent=0
width qr:10 / bc:2 QR: حجم الوحدة 2-40 بكسل · باركود: عرض الشريط 1-8
height 80 ارتفاع الباركود بالبكسل (20-400). لا يُطبّق على QR
output json image = بث PNG مباشر · json = JSON مع base64

💻 أمثلة تكامل

cURL / Terminal

# تحميل رمز QR شفاف
curl "https://ultdtc.com/api?api_key=YOUR_KEY&data=Hello+World&type=qr&transparent=1&output=image" \
  -o qrcode.png

PHP

<?php
$url = "https://ultdtc.com/api?" . http_build_query([
    "api_key"     => "YOUR_KEY",
    "data"        => "https://example.com",
    "type"        => "qr",
    "transparent" => 1,
    "output"      => "image",
]);
file_put_contents("qrcode.png", file_get_contents($url));
?>

Python (requests)

import requests

resp = requests.get("https://ultdtc.com/api", params={
    "api_key":     "YOUR_KEY",
    "data":        "https://example.com",
    "type":        "qr",
    "transparent": 1,
    "output":      "image",
})
with open("qrcode.png", "wb") as f:
    f.write(resp.content)
print("Done!")

JavaScript (fetch)

// Get base64 PNG via JSON output
const params = new URLSearchParams({
  api_key: "YOUR_KEY",
  data:    "https://example.com",
  type:    "qr",
  transparent: 1,
  output: "json"
});

const res  = await fetch("https://ultdtc.com/api?" + params);
const json = await res.json();
document.getElementById("qr-img").src = json.image_base64;

📊 التكامل مع Excel — توليد تلقائي

يمكنك توليد آلاف رموز QR أو الباركود تلقائياً من Excel بخطوتين فقط: ضع بياناتك في العمود A، واستدعِ الـ API بالقيمة المناسبة.

الخطوة 1: هيكل الجدول

A B C
البيانات / الرابط API URL الصورة
https://example.com =CONCAT("https://ultdtc.com/api?api_key=KEY&data=",ENCODEURL(A2),"&type=qr&transparent=1&output=image") =IMAGE(B2)
Product-SKU-1234 =CONCAT("https://ultdtc.com/api?api_key=KEY&data=",ENCODEURL(A3),"&type=barcode&output=image") =IMAGE(B3)

* دالة =IMAGE() متاحة في Excel 365 وGoogle Sheets. في Google Sheets: =IMAGE(B2)

الخطوة 2: ماكرو VBA لتحميل الصور تلقائياً

افتح محرر VBA (Alt+F11)، أنشئ وحدة نمطية جديدة، والصق الكود التالي:

Sub GenerateQRCodes()
    Dim ws As Worksheet
    Dim apiKey As String
    Dim baseUrl As String
    Dim lastRow As Long
    Dim i As Long
    Dim qrUrl As String
    Dim savePath As String

    apiKey  = "YOUR_API_KEY_HERE"
    baseUrl = "https://ultdtc.com/api"
    ws      = ActiveSheet
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    savePath = ThisWorkbook.Path & "\qr_codes\"

    ' Create folder if it does not exist
    If Dir(savePath, vbDirectory) = "" Then MkDir savePath

    For i = 2 To lastRow
        Dim data As String
        data = ws.Cells(i, 1).Value
        If Trim(data) = "" Then GoTo NextRow

        qrUrl = baseUrl & "?api_key=" & apiKey _
              & "&data=" & WorksheetFunction.EncodeURL(data) _
              & "&type=qr&transparent=1&output=image"

        Dim xhr As Object
        Set xhr = CreateObject("MSXML2.XMLHTTP")
        xhr.Open "GET", qrUrl, False
        xhr.send

        Dim fileName As String
        fileName = savePath & "qr_" & i & ".png"

        Dim stream As Object
        Set stream = CreateObject("ADODB.Stream")
        stream.Type = 1  ' Binary
        stream.Open
        stream.Write xhr.responseBody
        stream.SaveToFile fileName, 2
        stream.Close

        ws.Cells(i, 3).Value = fileName   ' Store path in col C
        NextRow:
    Next i

    MsgBox "Done! " & (lastRow - 1) & " QR codes saved to " & savePath
End Sub

📦 شكل الاستجابة (output=json)

{
  "success": true,
  "type": "qr",
  "transparent": true,
  "caller_ip": "203.0.113.5",
  "image_base64": "data:image/png;base64,iVBORw0KGgo...",
  "daily_requests_remaining": 87
}

عند وصول daily_requests_remaining إلى صفر، يرجع API رمز خطأ 429.

🔒 قائمة IP المسموحة

من لوحة التحكم يمكنك تقييد مفتاحك بحيث لا يقبل إلا طلبات من عناوين IP محددة (مثل خادمك أو شبكتك). إذا لم تضف أي عنوان، تُقبَل جميع الطلبات. إدارة IPs ←