Ciao a tutti,
Sto cercando il modo migliore (o una procedura ben documentata / guida per principianti) per configurare un Bot che aggiorni un Post su Discourse.
Vogliamo utilizzare un Raspberry Pi per controllare alcuni interruttori e, in base al loro stato, aggiornare un Post nel nostro Forum.
Qualsiasi buon consiglio è ben accetto. Grazie in anticipo.
Richarde
Pravi
(PK)
26 Giugno 2021, 6:44pm
2
Per aggiornare un post da remoto, devi configurare un ricevitore email oppure puoi affidarti all’API di Discourse.
1 Mi Piace
Grazie @Pravi
Esiste qualche guida per principianti su questo?
Grazie in anticipo
Modifica: mentre pensavo alle possibilità che l’API offre, preferirei quella soluzione.
Inizierò subito a cercare informazioni su come configurarla… qualsiasi suggerimento è benvenuto.
fzngagan
(Faizaan Gagan)
27 Giugno 2021, 12:33pm
4
Puoi utilizzare questo gem per connetterti al tuo Discourse ed eseguire tutte le operazioni necessarie.
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…
4 Mi Piace
Pravi
(PK)
27 Giugno 2021, 12:35pm
5
Non ho mai utilizzato l’API di Discourse prima d’ora, quindi non posso aiutarti con l’API. Tuttavia, spero che i seguenti link ti siano utili per iniziare.
https://meta.discourse.org/search?q=discourse%20api
Discourse API
Please view the Discourse API Documentation site for detailed info:
https://docs.discourse.org
Authentication
API requests must use HTTP header based authentication. Pass your Api-Key and Api-Username as HTTP headers. Authentication via query parameters or request body is not supported (this was removed in April 2020). Please see the example cURL request below.
The only API endpoints that continue to support credentials in query parameters are requests to…
https://meta.discourse.org/t/how-to-run-data-explorer-queries-with-the-discourse-api/120063/2
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 …
3 Mi Piace
Sono in viaggio:
Cosa ho fatto finora:
Ho generato una chiave API
Ho scritto alcune richieste PUT e GET in Postman, che hanno funzionato perfettamente
Ho esportato la raccolta come file JSON
So che esiste un framework Ruby per l’API, ma preferirei Python, dato che ho già realizzato alcuni script in quel linguaggio.
Qualcuno ha un’idea su come procedere?
Cordiali saluti,
Richarde
1 Mi Piace
Ok, ho appena trovato pydiscourse e sembra funzionare abbastanza bene
Quindi il passaggio di impostare tutto in Postman non era necessario, ma ha aiutato a capire la logica dell’API, quindi non è stato una completa perdita di tempo
In breve: se vuoi interagire con il tuo Discourse tramite Python, puoi usare pydiscourse di
(Basato sulla lista originale degli autori e potrebbe essere incompleta)
Marc Sibson
James Potter
Ben Lopatin
Daniel Zohar
Matheus Fernandes
Scott Nixon
Jason Dorweiler
Pierre-Alain Dupont
Karl Goetz
Alex Kerney
Gustav https://github.com/dkgv
2 Mi Piace
system
(system)
Chiuso
27 Luglio 2021, 5:30pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.