الرئيسية / أوصاف المنتجات: طرق API

أوصاف المنتجات: طرق API

راجع طرق HTTP الثلاث لحساب تكلفة أوصاف المنتجات وإنشاء المستند وجلبه. تعرّف على الحقول المطلوبة واستجابات JSON.

في هذه الصفحة

اختر طريقة من الفهرس. تحقق من طريقة HTTP والمسار والصلاحيات والمعلمات الإلزامية وجسم الطلب. كتل JSON التي تحتوي على schema وproperties و$ref تصف العقد، ولا تُرسل باعتبارها جسم طلب جاهزًا. أمثلة الطلبات ومخططات الردود معنونة بشكل منفصل.

POST /public-api/v1/ai-writer/product-descriptions/cost

يتطلب نطاق المفتاح ai-product-descriptions:read وصلاحية الحساب public-api-product-descriptions.show. يتوفر المسار المكافئ للاختبار بمفتاح test ضمن /public-api-test/v1 مع لاحقة المسار نفسها. تستخدم بيئة sandbox بيانات اختبار، دون ذكاء اصطناعي أو رسوم فعلية. يُرجع اسم المنتج العادي نتيجة ناجحة؛ ويُرجع sandbox:product_not_recognized الرمز 422؛ ويُرجع sandbox:async_product_not_recognized وsandbox:product_description_failed الخطأ المقابل بعد pending. تتوفر مستندات الاختبار لمدة 7 أيام أو حتى إعادة ضبط sandbox، أيهما أسبق.

نماذج البيانات المرتبطة: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionCost · ProductDescriptionRequest

الطلب

محتوى JSON بحجم يصل إلى 16384 بايت.

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductDescriptionRequest"
      }
    }
  }
}

الاستجابات

200

النتيجة الحالية؛ لا يحجز تقدير التكلفة أرصدة ولا يستهلكها.

{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductDescriptionCost"
      }
    }
  }
}

default

عند غياب المفتاح أو عدم صلاحيته، تصف ترويسات الحدود المحاولات الفاشلة لكل IP. بعد المصادقة تصف حدود المفتاح أو الحساب. قد تغيب عند الحظر المسبق أو تعذّر استخدام العدّاد. X-RateLimit-Reset طابع Unix بالثواني؛ وRetry-After عند 429 مدة انتظار بالثواني.

{
  "headers": {
    "X-Request-ID": {
      "$ref": "#/components/headers/XRequestID"
    },
    "X-RateLimit-Limit": {
      "$ref": "#/components/headers/RateLimitLimit"
    },
    "X-RateLimit-Remaining": {
      "$ref": "#/components/headers/RateLimitRemaining"
    },
    "X-RateLimit-Reset": {
      "$ref": "#/components/headers/RateLimitResetAt"
    },
    "Cache-Control": {
      "$ref": "#/components/headers/CacheControl"
    },
    "Retry-After": {
      "$ref": "#/components/headers/RetryAfter"
    }
  },
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ErrorResponse"
      }
    }
  }
}

POST /public-api/v1/ai-writer/product-descriptions/documents

يتطلب نطاق المفتاح ai-product-descriptions:write وصلاحية الحساب public-api-product-descriptions.show. يتوفر المسار المكافئ للاختبار بمفتاح test ضمن /public-api-test/v1 مع لاحقة المسار نفسها. تستخدم بيئة sandbox بيانات اختبار، دون ذكاء اصطناعي أو رسوم فعلية. يُرجع اسم المنتج العادي نتيجة ناجحة؛ ويُرجع sandbox:product_not_recognized الرمز 422؛ ويُرجع sandbox:async_product_not_recognized وsandbox:product_description_failed الخطأ المقابل بعد pending. تتوفر مستندات الاختبار لمدة 7 أيام أو حتى إعادة ضبط sandbox، أيهما أسبق.

نماذج البيانات المرتبطة: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionCost · ProductDescriptionRejected · ProductDescriptionRequest · ProductDescriptionStart

المعلمات

Idempotency-Key (header)

مطلوب للتوليد المدفوع. يعيد الاستجابة لمدة 24 ساعة للمفتاح والمسار ومحتوى الطلب المطابق نفسه. يُرجع المحتوى المختلف الرمز 409. تظل الطلبات المتزامنة وعمليات البدء ذات النتائج غير المؤكدة محظورة بالرمز 409؛ لا تُعد المحاولة بمفتاح جديد.

{
  "required": true,
  "schema": {
    "type": "string",
    "minLength": 1,
    "maxLength": 128,
    "pattern": "^[A-Za-z0-9._:-]+$"
  }
}

الطلب

محتوى JSON بحجم يصل إلى 16384 بايت.

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductDescriptionRequest"
      }
    }
  }
}

الاستجابات

202

تم قبول التوليد؛ التكلفة هي الحد الأقصى المحجوز.

{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductDescriptionStart"
      }
    }
  }
}

422

الأرصدة غير كافية أو يوجد إخفاق في التعرف على المنتج مخزّن مؤقتًا خلال آخر 7 أيام (error.code=product_not_recognized, credits_spent=0). لا يبدأ التوليد. بعد تغيير المعلمات أو شحن الرصيد، استخدم Idempotency-Key جديدًا.

{
  "content": {
    "application/json": {
      "schema": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProductDescriptionCost"
          },
          {
            "$ref": "#/components/schemas/ProductDescriptionRejected"
          }
        ]
      }
    }
  }
}

409

{
  "headers": {
    "X-Request-ID": {
      "$ref": "#/components/headers/XRequestID"
    },
    "X-RateLimit-Limit": {
      "$ref": "#/components/headers/RateLimitLimit"
    },
    "X-RateLimit-Remaining": {
      "$ref": "#/components/headers/RateLimitRemaining"
    },
    "X-RateLimit-Reset": {
      "$ref": "#/components/headers/RateLimitResetAt"
    },
    "Cache-Control": {
      "$ref": "#/components/headers/CacheControl"
    },
    "Retry-After": {
      "$ref": "#/components/headers/RetryAfter"
    }
  },
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ErrorResponse"
      }
    }
  }
}

default

{
  "headers": {
    "X-Request-ID": {
      "$ref": "#/components/headers/XRequestID"
    },
    "X-RateLimit-Limit": {
      "$ref": "#/components/headers/RateLimitLimit"
    },
    "X-RateLimit-Remaining": {
      "$ref": "#/components/headers/RateLimitRemaining"
    },
    "X-RateLimit-Reset": {
      "$ref": "#/components/headers/RateLimitResetAt"
    },
    "Cache-Control": {
      "$ref": "#/components/headers/CacheControl"
    },
    "Retry-After": {
      "$ref": "#/components/headers/RetryAfter"
    }
  },
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ErrorResponse"
      }
    }
  }
}

GET /public-api/v1/ai-writer/product-descriptions/documents/{document_id}

يتطلب نطاق المفتاح ai-product-descriptions:read وصلاحية الحساب public-api-product-descriptions.show. يتوفر المسار المكافئ للاختبار بمفتاح test ضمن /public-api-test/v1 مع لاحقة المسار نفسها. تستخدم بيئة sandbox بيانات اختبار، دون ذكاء اصطناعي أو رسوم فعلية. يُرجع اسم المنتج العادي نتيجة ناجحة؛ ويُرجع sandbox:product_not_recognized الرمز 422؛ ويُرجع sandbox:async_product_not_recognized وsandbox:product_description_failed الخطأ المقابل بعد pending. تتوفر مستندات الاختبار لمدة 7 أيام أو حتى إعادة ضبط sandbox، أيهما أسبق.

نماذج البيانات المرتبطة: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionDocument

المعلمات

document_id (path)

{
  "required": true,
  "schema": {
    "type": "string"
  }
}

الاستجابات

200

حالة وصف المنتج الخاص بالمالك. أعد الاستعلام عن النتائج pending بعد 10 ثوانٍ.

{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductDescriptionDocument"
      }
    }
  }
}

default

{
  "headers": {
    "X-Request-ID": {
      "$ref": "#/components/headers/XRequestID"
    },
    "X-RateLimit-Limit": {
      "$ref": "#/components/headers/RateLimitLimit"
    },
    "X-RateLimit-Remaining": {
      "$ref": "#/components/headers/RateLimitRemaining"
    },
    "X-RateLimit-Reset": {
      "$ref": "#/components/headers/RateLimitResetAt"
    },
    "Cache-Control": {
      "$ref": "#/components/headers/CacheControl"
    },
    "Retry-After": {
      "$ref": "#/components/headers/RetryAfter"
    }
  },
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ErrorResponse"
      }
    }
  }
}

قبل استخدام ناتج الذكاء الاصطناعي، تحقق من الحقائق واسم الشركة أو المنتج واللغة وتوافق الناتج مع المدخلات. راجع HTML المولّد قبل النشر. النجاح التقني لا يغني عن مراجعة المحتوى.