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.
2 Mi Piace
Anche interessato a questa domanda
Non riesco a trovare un modo per caricare un file su Topic e Post tramite l’API.
Forse qualcuno può suggerire un metodo.
AGGIORNAMENTO:
L’ho capito, il metodo è descritto nella documentazione e funziona.
- Carica un file usando “/uploads.json”, in risposta otteniamo l’URL breve del file caricato come “upload://ueNyWDEgHhXIuIdB472fy9T6.txt”
- Aggiorniamo il post con una seconda richiesta API, aggiungendo una riga come questa alla fine di post[raw]:
[filename.txt|attachment](upload://ueNyWlEgHhXIuIdB472fy9T6.txt) (1.83 KB)
6 Mi Piace
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.