كيفية رفع ملف عبر واجهة برمجة التطبيقات والحصول على عنوان URL الخاص به؟

Hello, I want to upload a file(not an image) via the API and get the URL back. How can I accomplish this?
I tried the solution provided here: https://meta.discourse.org/t/using-the-discourse-api-to-post-with-uploaded-files/29833/23 but it seems that it is no longer up to date.

See How to reverse engineer the Discourse API

إعجابَين (2)

أيضًا مهتم بهذا السؤال
لا أستطيع العثور على طريقة لرفع ملف إلى الموضوع والمشاركة عبر واجهة برمجة التطبيقات.
ربما يمكن لأحد اقتراح طريقة.

تحديث:
تمكنت من حلها، والطريقة موصوفة في الوثائق وهي تعمل.

  1. قم برفع ملف باستخدام “/uploads.json”، وفي الاستجابة نحصل على الرابط القصير للملف المرفوع مثل “upload://ueNyWDEgHhXIuIdB472fy9T6.txt”
  2. نقوم بتحديث المشاركة بطلب واجهة برمجة التطبيقات الثاني، بإضافة سطر مثل هذا في نهاية post[raw] تمامًا:
    [filename.txt|attachment](upload://ueNyWlEgHhXIuIdB472fy9T6.txt) (1.83 KB)
6 إعجابات

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.