اعرض مؤشر P3 في بوابتك خلال 5 دقائق
من مفتاح تجريبي إلى خط المؤشر في صفحتك، مع تخزين مؤقت لتستدعي الواجهة فقط عند تغيّر المؤشر.
احصل على مفتاح تجريبي
ينشئه أحد مشرفي مؤسستك في P3: المؤسسة ← المطورون ← المفاتيح، البيئة تجريبية، النطاق index:read. احتفظ به على خادمك.
اعرض المناطق
لكل منطقة معرّف نصي، واسمها بالإنجليزية والعربية، وآخر مؤشر لأسعار البيع والإيجار.
curl https://api.pthree.vip/v1/areas?city=dubai \
-H "Authorization: Bearer $P3_API_KEY"اجلب مؤشر منطقة
مستويات شهرية من الأقدم، مع نطاق 90%. شهر الأساس يساوي 100. استخدم from وto لتحديد فترة.
curl "https://api.pthree.vip/v1/index/price?area=dubai-marina&from=2025-01" \
-H "Authorization: Bearer $P3_API_KEY"ارسمه في صفحتك
اعرضه من خادمك كي لا يصل المفتاح إلى المتصفح. اذكر المصدر: خطة Open تطلب الإشارة إلى مؤشر P3.
// A server-rendered line for your page (no chart library needed).
function indexLine(points, width = 600, height = 160) {
const values = points.map((p) => p.value);
const min = Math.min(...values), max = Math.max(...values);
const x = (i) => (i / (points.length - 1)) * width;
const y = (v) => height - ((v - min) / (max - min || 1)) * height;
const d = points.map((p, i) => `${i ? "L" : "M"}${x(i).toFixed(1)},${y(p.value).toFixed(1)}`).join(" ");
const last = points.at(-1);
return `<figure>
<svg viewBox="0 0 ${width} ${height}" role="img" aria-label="P3 Price Index, ${points[0].period} to ${last.period}">
<path d="${d}" fill="none" stroke="#0E7C66" stroke-width="2"/>
</svg>
<figcaption>P3 Price Index: ${last.value} in ${last.period}. Source: P3 Index.</figcaption>
</figure>`;
}خزّن مؤقتًا باستخدام ETag
يُنشر المؤشر شهريًا، فمعظم الطلبات لا تغيّر شيئًا. أعد ETag في If-None-Match ليجيب P3 بالرمز 304.
# The second call answers 304 Not Modified while the index is unchanged.
curl -i "https://api.pthree.vip/v1/index/price?area=dubai-marina" \
-H "Authorization: Bearer $P3_API_KEY" \
-H 'If-None-Match: W/"3ea39a99cfc35230"'حين يعمل كل شيء، استبدل المفتاح التجريبي بمفتاح فعلي. لا يتغير شيء آخر.