المكتبة التقنية ←

استدعاء REST APIs من Oracle APEX

English version

APEX can consume an external REST API through REST Data Sources or APEXWEBSERVICE. The first successful request is only the beginning of a reliable integration.

For declarative reports, start by evaluating a REST Data Source. For custom orchestration, MAKERESTREQUEST returns a response body that your PL/SQL can process. Outbound network access, TLS configuration, credentials, and the remote service's contract still matter; you do not need to create a new ORDS endpoint just to make an outbound call.

Check the response before parsing

Inspect the HTTP status, expected content type, and response shape. A server error may return HTML rather than the JSON your code expects. Set sensible timeouts and distinguish authentication failures from temporary outages.

Match the JSON structure

An object containing currency names is not the same as an array of currency rows. Choose JSONOBJECTT, JSONTABLE, or APEXJSON APIs that match the actual payload. Do not invent an array index for object keys.

Keep secrets out of page code

Use configured credentials where supported. Avoid logging access tokens or complete sensitive responses. For write requests, decide how retries avoid duplicate business actions.

Editorial correction: the original parsing example treated a JSON object like an array and referenced an unverified GET_KEY API. This revision replaces it with structure-aware guidance.

Reference: Oracle: calling REST APIs without a data source.

النسخة العربية

APEX يقدر يستهلك REST API عن طريق REST Data Sources أو APEXWEBSERVICE، لكن نجاح أول طلب مجرد بداية لتكامل يعتمد عليه.

للتقارير التصريحية، ابدأ بتقييم REST Data Source. وللمنطق المخصص، MAKERESTREQUEST ترجع جسم الاستجابة لمعالجته في PL/SQL. تظل إعدادات الشبكة وTLS والـCredentials وعقد الخدمة مهمة؛ مش لازم تبني ORDS Endpoint جديد لمجرد تنفيذ طلب صادر.

راجع الرد قبل تحليل JSON

افحص HTTP Status ونوع المحتوى وشكل الاستجابة. خطأ السيرفر ممكن يرجع HTML بدل JSON. حدد Timeout مناسب، وافصل فشل المصادقة عن تعطل مؤقت.

اختار التحليل المناسب للبنية

Object مفاتيحه أسماء عملات مختلف عن Array من صفوف العملات. استخدم JSONOBJECTT أو JSONTABLE أو APEXJSON بما يطابق الرد الحقيقي، ولا تعامل مفاتيح Object كأنها فهارس Array.

احمِ بيانات الاعتماد

استخدم Credentials مهيأة بدل وضع الأسرار في الصفحة. لا تسجل Tokens أو استجابات حساسة كاملة. وفي طلبات الكتابة، صمم إعادة المحاولة بحيث لا تكرر العملية التجارية.

تصحيح تحريري: المثال القديم عامل JSON Object كأنه Array، وأشار إلى GET_KEY بدون تحقق. استبدلته بإرشادات تعتمد على بنية الاستجابة الفعلية.

المرجع: استدعاء REST من APEX.