elRicharde
(Richard Gruhle)
June 26, 2021, 4:05pm
1
Hi Folks,
I´m looking for the best way (or a good documented way / beginner guide) to set up a Bot Updating a Post in Discourse.
We want to use a Raspi to Check some Switches and depending on there state we want to update a Post in our Forum.
Any good advice welcome. Thx in Advance.
Richarde
Pravi
(PK)
June 26, 2021, 6:44pm
2
Inorder to update a post remotely you have to either configure an email receiver or you may depend on discourse API.
1 Like
elRicharde
(Richard Gruhle)
June 27, 2021, 11:53am
3
Thx @Pravi
Is there any beginners guides to this?
Thanks in Advance
Edit: while thinking about the possibilities the API brings, I would prefer that solution.
Will start to dig now for informations about setting that up… any hints welcome.
fzngagan
(Faizaan Gagan)
June 27, 2021, 12:33pm
4
You can use this gem to connect to your discourse and perform any operations you need.
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 , OS X 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
Install dep…
4 Likes
Pravi
(PK)
June 27, 2021, 12:35pm
5
I have never used the discourse API before. So I am unable to help you with API. But I hope the following links will help you get started.
https://meta.discourse.org/search?q=discourse%20api
Discourse API
Please view the Discourse API Documentation site for detailed info:
https://docs.discourse.org
Deprecation Warning!
On April 6th, 2020 we dropped support for all non-HTTP header based authentication (excluding some rss, mail-receiver, and ics routes). This means that API requests that have an api_key and api_username in the query params or in the HTTP body of the request will soon stop working. Please see the example cURL request below for how to update your API requ…
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.
Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.
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 XHR filter:
[image]
Perform the op…
3 Likes
elRicharde
(Richard Gruhle)
June 27, 2021, 3:37pm
6
I´m on the way:
what I´ve done so far:
generating a Api Key
writing a few Put and a Get request in Postman which worked perfectly
exported the collection as json file
I know there is a ruby framework for the API but i would prefer python as a did some scripts there already.
Anyone has an idea how to proceed?
best regards
Richarde
1 Like
elRicharde
(Richard Gruhle)
June 27, 2021, 5:29pm
7
Ok, I just found pydiscourse and that seems to work pretty good
So the Step setting everything up in Postman wasn´t necessary but helped to understand the logic of the api - so it wasn´t a complete waste of time
in short - if you want to interact with your discourse via python you can use pydiscourse by
(Based on original authors list and may be incomplete)
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 Likes
system
(system)
Closed
July 27, 2021, 5:30pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.