Codebase Pot Pie - Or what I like or wish I could have
-
Rhost's API is HTTP based but not RESTful.
Rhost listens on a separate API port. You connect to that port, authenticating with a dbref and a password. (This password is NOT the login password but is set with @api/password obj=pw) via Basic HTTP authentication.
The dbref must have the API @power.
The API is entirely header based. If you do a GET request, the 'Exec' header evaluates code as that dbref and returns its result. If you do a POST request, the 'Exec' header is a series of commands that are run. Basically, GET is like u() and POST is like @tri.
There's some other details: POST can have a Time header which will delay the commands that long. GET can have a Parse header which will determine if it evaluates the code as normal, only as substitutions, or ansi, and some other options. It can also have an Encode header to return the content in base64.
This basically allows you to execute arbitrary code / responses in the MUSH from external scripts. And with the execscript() function you can execute external scripts from within the game.
I haven't used it a lot yet, but one way I do use it is before I would have a timer on my game to dump a flatfile every so file. Now, my backup script (run by linux's cron) uses the API to @dump/flat before it runs.
-
@ixokai said in Codebase Pot Pie - Or what I like or wish I could have:
Rhost's API is HTTP based but not RESTful.
I'm confused. Didn't @Ashen-Shugar announce it by saying:
"Rhost's RESTapi is effectively completed and live."
-
@faraday said in Codebase Pot Pie - Or what I like or wish I could have:
@ixokai said in Codebase Pot Pie - Or what I like or wish I could have:
Rhost's API is HTTP based but not RESTful.
I'm confused. Didn't @Ashen-Shugar announce it by saying:
"Rhost's RESTapi is effectively completed and live."
It's 'psudo restful'.
It essentially uses all header-driven queries to push and pull data from the engine.
I could make it fully restful, but having full pathing in an http request didn't make much sense for a mush distribution, and honestly headers works quite nicely.
-
I'd call it inspired (more STEP then REST), but really, the API is not in any meaningful way RESTful.
A RESTful API would be like GET http://whatever/object/attribute and PUSH http://whatever/object and ...etc. This is more low level then that. There's no URL routing like you'd expect from a REST api.
I think Ash might have misspoken because his job experience isn't really in the realm of REST.
Its a HTTP header-based API that's capable of doing almost anything but it does so by remotely accepting commands or functions to evaluate (and return data from).
-
@Ashen-Shugar said in Codebase Pot Pie - Or what I like or wish I could have:
It's 'psudo restful'.
It seems to be a perfectly fine API, but as @ixokai says, it's really "not in any meaningful way RESTful". Using REST when describing it is wildly misleading.
Anyway, @Ghost - ignore the links I shared; they've got nothing whatsoever to do with the RHost API.
-
We need open source code to make coding easier, like a MUSH version of Windows.
j/k