• Support
  • Do we have a public API for Flarum?

thimiraonline (following luceos ) yes, there is a REST API for Flarum and is also used internally by Flarum core.
Actually there isn't an updated list of routes/endpoints but there is an old doc here that lists all the endpoints as of April 2017): https://github.com/flarum/flarum.github.io/blob/20322c0e6011e4f304ae7e95f41594a0b086bc27/_docs/api.md
Almost all of the endpoints available in this document works and are the same in Flarum 1.0, although something has changed.

@luceos maybe this old document should be restored and updated

    maicol07 Can we use this API to build a native app for Flarum forums and connect firebase or other services to send notifications automatically?

    I have installed the Flarum API client

    composer require maicol07/flarum-api-client

      maicol07 Please advise, we are going to build a native Android app and make it open source. That's why we are sinking to this. 😁

      It depends what you mean by sending notifications.

      Flarum has notification drivers. By default there's web and email. Additional drivers can be created by extensions using the Flarum PHP extension API.

      If you want to broadcast the notifications of an existing driver, you could read the existing notifications and forward them to a different API. This could be achieved via the REST API by reading the GET /api/notifications endpoint but you would need to make one request per user, and poll on a regular interval, which likely isn't an optimal solution.

      Using the PHP extension API you could hook into Flarum to react to a new web or email notification being triggered, or register the new notification driver with a completely independent implementation from web and email.

        clarkwinkelmann That means we have to implement a new service or a method to send notifications to individuals? Isn't it?