high level REST client and server are provided?
#1
high level REST client and server are provided?

ex. Is there a plan to expose C++ REST SDK for lua plugin?
Reply
Thanks given by:
#2
Hello, welcome to the forum.

Is there even a REST SDK? From what I've read, it's just a "style", not a specific protocol.

I suppose this very much depends on HTTP(S); the server currently doesn't expose APIs for working with HTTP(S), but it does indeed have internal implementations for them, so it's only a matter of time before they get exposed. Care must be taken when doing so because of the inherent need for the plugins to never block - all the operations must be callback-based.

SSL/TLS is already exposed through the cNetwork API classes, so it is possible to actually implement the rest of the entire stack in Lua, if desired.
Reply
Thanks given by:
#3
Thank you for responding.

cNetwork API seems a little bit low level.
We need to parse the text as HTTP from received document.

Any more higher API to handle HTTP/REST request/response?
Reply
Thanks given by:
#4
Not at this moment, but I'm working on it right now, hopefully it'll be finished after Christmas. I've started with Json parsing and serialization, which is currently under review: https://github.com/cuberite/cuberite/pull/2801

There's a rough mindmap for the HTTP framework, if you want to peek: https://github.com/madmaxoft/cuberite-mindmap (You'll need Freeplane or any other Freemind-based viewer to view the file) under the HTTP exposed section. Basically I'm planning three levels of API:
- low level - provides callback-based streaming parsing and building of all things HTTP - requests, headers, name-value pairs
- mid-level - wraps the low-level parsers around a TCP socket with optional TLS
- high-level - somewhat like Python's UrlLib, you give it an URL and parameters, it calls back when a complete response is ready
Reply
Thanks given by:
#5
I suppose I should post an update to this thread Smile

Unfortunately I haven't done much on the API side of things. I have revised the underlying C++ code (low level API) and prepared it for both client-side and server-side operations, but haven't exported it to Lua yet. I have started working on the high-level API, but the work halted due to other issues being more important.

One thing that did make it into the API and is fully usable and documented, is the cUrlParser class, that can be used to parse URL into its individual parts: http://luaapi.cuberite.org/cUrlParser.html
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)