https://docs.flarum.org/rest-api#creation
Absolutely ingenious documentation. 👏
First of all, this is the first ever self-hostable server, I have ever used, which actually, officially, requires fiddling with the database. Bad practice over 9000.
Anyway, so the documentation says it should be done via the database. How?
Is the documentation supposed to help or mock the reader? Because if you are telling someone to fiddle with internals, you better provide a working example or you are literally inviting someone to break a running system.
For anyone interested, I actually made the effort on publishing the lacking documentation.
mysql -u flarum_user flarum_database -p
Replace flarum_user
and flarum_database
with your database user & database name. The password will be read by prompt, upon entering the command.
On successful authentication, you enter the MySQL / MariaDB CLI.
INSERT INTO flarum_api_keys(`key`, created_at) VALUES('mysuperinsecureapikey', NOW());
Replace mysuperinsecureapikey
with your API key, which ought to be between 40 & a 100 alphanumeric characters long.
Wow, it was so hard to provide this one-liner. I now understand why it isn't naturally part of the documentation.