deathandmayhem / jolly-roger

Dead men tell no tales!
MIT License
18 stars 5 forks source link

Feature request: Simple REST(?) API for adding puzzles #1948

Open egnor opened 5 months ago

egnor commented 5 months ago

We have users (@dougz) who like to write little scrapers to auto-populate our solving aids from the Hunt site. In recent years, Hunt site runners have been offering puzzle lists in JSON or otherwise machine-readable format which is amazing!

To make this easier to do it would be neat to have some very simple interface which scripts could use to add puzzles. (And maybe enumerate existing puzzles, so they could check for dupes.)

ebroder commented 5 months ago

Huh, I don't think I had realized there was a JSON dump. We've had an open ticket (#237) to build this kind of scraping into Jolly Roger for ages, but I'd also be pretty open to exposing an API for external scripting.

We do have some basic REST API structure. Right now it exists to allow a third-party team website to use Jolly Roger as an authz source, but it shouldn't be terribly hard to extend. Some basic notes on how it works (since we should - but don't currently - have any docs):

egnor commented 5 months ago

@ebroder (get your barf bag out) as a stopgap, would just adding an entry to the database do the right thing as far as adding a puzzle? (obviously very brittle and to be replaced with a proper API in future) or is there enough denormalized content around puzzle creation (not to mention sheet creation, etc) that it would be way too hard?

ebroder commented 5 months ago

Hmm. It might work? I definitely wouldn't recommend it. Main thing I'll note is to make sure you get the types right (although the database schema should enforce it). I think the main functionality you'll lose is the ability to create puzzles with Google Docs instead of Sheets - may not be important to you but we tend to use it for meta-hunt things.

If you really want to hack something together, I might try to find a standalone DDP client (a la https://github.com/Gregivy/simpleddp) and invoke the Meteor methods that way.