واجهة برمجة تطبيقات ديسكورس (Discourse API)
يرجى الاطلاع على موقع وثائق واجهة برمجة تطبيقات ديسكورس (Discourse API Documentation) للحصول على معلومات مفصلة:
https://docs.discourse.org
المصادقة (Authentication)
يجب أن تستخدم طلبات واجهة برمجة التطبيقات المصادقة المستندة إلى رأس HTTP (HTTP header). قم بتمرير مفتاح واجهة برمجة التطبيقات (Api-Key) واسم المستخدم لواجهة برمجة التطبيقات (Api-Username) كرؤوس HTTP. لا يتم دعم المصادقة عبر معلمات الاستعلام (query parameters) أو نص الطلب (request body) (تمت إزالة هذا في أبريل 2020). يرجى الاطلاع على مثال طلب cURL أدناه.
نقاط النهاية الوحيدة لواجهة برمجة التطبيقات التي تستمر في دعم بيانات الاعتماد في معلمات الاستعلام هي الطلبات إلى خلاصات RSS، ونقطة نهاية مستقبِل البريد (Mail Receiver endpoint)، ومسارات ICS.
يمكن تعيين Content-Type إلى “application/x-www-form-urlencoded”، أو “multipart/form-data”، أو “application/json”.
إليك مثال لطلب POST عبر cURL:
curl -X POST "http://127.0.0.1:3000/categories" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: discourse1" \
-F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \
-F "color=49d9e9" \
-F "text_color=f0fcfd"
إليك مثالًا لما يبدو عليه [موقع وثائق واجهة برمجة التطبيقات] (https://docs.discourse.org ):
استهلاك واجهة برمجة التطبيقات (Consuming the API)
يمكنك استهلاك واجهة برمجة التطبيقات باستخدام أوامر cURL، ولكننا نوصي باستخدام جوهرة [discourse_api] (GitHub - discourse/discourse_api: Ruby API for Discourse · GitHub ) حتى تتمكن من استخدام Ruby.
So you want to use Discourse API ? Great! Let’s get started.
Set up Discourse development environment
Set up Discourse development environment using our Windows , macOS or Ubuntu guide.
Clone Discourse API Gem
Now that you have set up Discourse development environment, you should already have Git and Ruby installed on your system. You can install Discourse API gem by running following command from console:
git clone https://github.com/discourse/discourse_api.git ~/discourse_api
Alternatively…
الهندسة العكسية لنقاط نهاية واجهة برمجة التطبيقات (Reverse engineering API endpoints)
لم يتم توثيق كل نقطة نهاية، ولكن يمكنك رؤية مثال لطلب واستجابة واجهة برمجة التطبيقات لأي نقطة نهاية باتباع هذا الدليل:
Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
The API is documented at docs.discourse.org . You can also use the discourse_api Ruby gem as a client library. However, not every endpoint is documented.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select …
حدود المعدل العامة والتنظيم في ديسكورس (Global rate limits and throttling in Discourse)
يأتي ديسكورس بثلاثة حدود معدل عامة مختلفة يمكن لمسؤولي الموقع تكوينها. لمزيد من التفاصيل حول هذه الحدود، راجع:
Discourse ships with 3 different global rate limits that can be configured by site admins.
Global per-ip rate limits
These limits apply to every unique IP address that hits the Discourse application. (files that are served directly from the filesystem or the CDN are excluded)
By default this rate limit is enabled, you may disable it or set it to a reporting mode.
DISCOURSE_MAX_REQS_PER_IP_MODE : default block, this rate limit applies out of the box. (other options are warn, warn+block, and no…
إنشاء الإشعارات عبر واجهة برمجة التطبيقات (Creating notifications via the API)
Hi, a quick question: Can you send notifications to users with the API? (or another way).
In the documentation, I found how to GET notifications of the user, how to mark them as read, but not how to POST some. If it isn’t possible, I guess there is always to possibility of using private messages instead.
I would appreciate any input on this. Thanks.
مواصفات مفاتيح واجهة برمجة تطبيقات المستخدم (User API keys specification)
Discourse contains a system for generating API keys per user if a very specific protocol is followed. This feature facilitates “application” access to Discourse instances without needing to involve moderators.
High level description
At a high level:
Client (desktop app, browser plugin, mobile app) generates a private/public key pair and return url
Client redirects to a route on discourse giving discourse its public key
Discourse gets approval from user to use app
Discourse generat…
آخر مراجعة بواسطة @sam في 2026-03-17T17:00:00Z