دليل التكامل مع API - gooe.ai

1. نظرة عامة

توفر خدمة gooe.ai واجهة API سهلة ومباشرة تتيح لك إنشاء روابط قصيرة تلقائيًا من تطبيقك أو موقعك. تحتاج فقط إلى استخدام رابط API وإرسال الرابط الأصلي مع رمز API الخاص بك للحصول على رابط مختصر.

2. كيفية الحصول على رمز API

قم بتسجيل الدخول إلى حسابك في موقع gooe.ai ثم انتقل إلى صفحة الإعدادات، وستجد رمز API الخاص بك هناك. يمكنك نسخه واستخدامه في جميع الطلبات.

3. تفاصيل الطلب

يجب إرسال الطلب إلى هذا الرابط باستخدام الطريقة GET:

https://gooe.ai/api/shortcut

ويجب تمرير المعاملات التالية ضمن الرابط:

  • url - الرابط الأصلي المطلوب اختصاره
  • token - رمز API الخاص بك

4. مثال PHP

<?php
$url = 'https://gooe.ai/api/shortcut/?url=' . urlencode('https://example.com') . '&token=your_token_here';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>

5. مثال JavaScript

fetch("https://gooe.ai/api/shortcut/?url=https://example.com&token=your_token_here")
  .then(response => response.text())
  .then(data => {
    console.log("Shortened Link:", data);
  })
  .catch(error => {
    console.error("Error:", error);
  });

6. مثال Python

import requests

params = {
    "url": "https://example.com",
    "token": "your_token_here"
}

response = requests.get("https://gooe.ai/api/shortcut", params=params)

if response.status_code == 200:
    print("Shortened URL:", response.text)
else:
    print("Error:", response.status_code)

7. الرد المتوقع

// عند النجاح
https://gooe.ai/abc12

// أو عند وجود خطأ
Missing URL or Token
Invalid token

8. الدعم الفني

لأي استفسارات أو مشاكل تقنية، يرجى الاتصال بنا