Connecting to Discourse
The Discourse API uses API Key authentication.
Using API Key Authentication
Discourse requires API Key and Username for authentication. API Keys are generated in the Discourse Admin panel under the API section. You can create user-specific API keys or all-users API keys. Once you have obtained the API Key, set it along with the Domain and Username in the ProfileSettings connection property.
Example Connection string
Profile=C:\profiles\Discourse.apip;ProfileSettings='Domain=forum.example.com;APIKey=your_api_key;Username=your_username;'AuthScheme=APIKey;
Usage Examples
Backups:
SELECT * FROM Backups
Badges:
SELECT * FROM Badges
Categories:
SELECT * FROM Categories
Events:
SELECT * FROM Events
GroupMembers:
SELECT * FROM GroupMembers WHERE GroupName = 'moderators'
Groups:
SELECT * FROM Groups
Notifications:
SELECT * FROM Notifications
PostReplies:
SELECT * FROM PostReplies WHERE PostId = 123
Posts:
SELECT * FROM Posts WHERE TopicId = 123
PrivateMessages:
SELECT * FROM PrivateMessages WHERE Username = 'john_doe'
PrivateMessagesSent:
SELECT * FROM PrivateMessagesSent WHERE Username = 'john_doe'
Site:
SELECT * FROM Site
SiteBasicInfo:
SELECT * FROM SiteBasicInfo
TagGroups:
SELECT * FROM TagGroups
Tags:
SELECT * FROM Tags
Topics:
SELECT * FROM Topics
TopTopics:
SELECT * FROM TopTopics
UserActions:
SELECT * FROM UserActions WHERE Username = 'john_doe'
Users:
SELECT * FROM Users
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIKey | The API Key for authenticating to your Discourse instance. |
| AuthScheme | The scheme used for authentication. Accepted entry is APIKey. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| Domain | The domain of your Discourse instance. |
| Username | The username associated with the API Key for Discourse authentication. |