-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support more RESTful API #91
Comments
I'm very glad to hear that tiedot could be useful to you. I'll think through it and get back to you soon. |
I like the idea very much, but unfortunately at the moment I do not have time working on this feature. Please take a look at: Would you like to give it a try at implementing these APIs? |
👍 for the suggested API, it will work great with Angular Resource which will make a new control panel development and other tiedot + angular apps very smooth. |
I might be able to work on this once I get a bit more experience with golang and some more free time. We're just starting to port an existing Java application to golang in order to be able to run in a smaller footprint. FYI, we're using tiedot to replace Hazelcast in the new architecture. |
I just added all of you into collaborator list, please feel free to experiment with Restful API implementations however you like! |
In the next few weeks I have some free time to spare and I'd like to tackle this issue. Anyone of the previous commenters is welcome to join me in the effort. As a start I was thinking to model the API using So, I vouch for OpenAPI/Swagger by using go-swagger. With go-swagger we can automate the creation of all the boilerplate code necessary for the client / server API, and automate the API validation too. All we need to do is to manually implement the models of the API. This way go-swagger can save us tons of time and the usual useless drama about API stability and its validation process. Any preference / suggestion / alternative about it? |
Hey Doctor. |
I decided to work on this enhancement using httprouter. Below you will see my proposed set of routes. They may change, but this is just the starting point.
ConsiderationsQuery Routes as a POST and not a GET API Routes Versioning API Backwards Compatibility If everything goes well I may have a full working version soon. |
Thanks very much @prods, please proceed with the proposal and I've added you to collaborator list. Would it be more appropriate to use POST action for /sync, /shutdown, and /dump? |
Thanks! and Yes, it makes perfect sense. Database engine specific operations should run on POSTS. I will update the route list and I will keep you posted. Let me know if you find anything else or you have any recommendation. |
Below is an updated version of the API Routes.
I did set the updates in bold. In other hand after closer review I realized that error messages are being returned as plain text and I would like to propose, as part of this api change, to upgrade all api results to JSON objects. See my initial proposal below... I kind of like verbose api errors but the idea is to keep it as simple as possible... {
"collection": "<COLLECTION_NAME>",
"operation": "<OPERATION>",
"error": "<ERROR MESSAGE>"
} Sample: {
"collection": "test_collection",
"operation": "delete",
"error": "Collection test_collection does not exist"
} Thoughts? |
Adding. Below is a better list of proposed error objects. Collection Operations {
"collection": "test_collection",
"operation": "delete",
"error": "Collection does not exist"
} Document Operations {
"collection": "test_collection",
"document": 19238928282,
"operation": "update",
"error": "Document does not exist"
} Engine Operations {
"operation": "dump",
"error": "Specified Path cannot be found"
} The error messages are not necessarily real. I added them in order to provide some examples. Let me know. |
Ok, just another update. I already created all the routes and successfully completed a first round of testing. Below you will see a few more changes in the proposal. As before I marked in bold the changes and included some possible response payloads for functions that are silent today.
I will continue the testing and I will keep you posted. Please feel free to post any idea, comment and/or concern... |
Looks really good so far! |
Just an update. This continues to move forward. Finding time here and there to complete it. You can take a pick at My Fork Branch. The API is now fully working and I am close to jump into documentation and final testing. I will keep you posted. |
Forgot mention, please make sure to run it using the new boolean |
Many thanks for your effort, the code is looking very good already. Would you mind creating a wiki article describing the usage of new API as well? Afterwards please merge the changes whenever you're ready. I must admit that I have sounded quite lazy so far, not offering much help, my excuse would be that this project https://github.com/HouzuoGuo/laitos is keeping me busy at the moment. |
No problem, already started working on the documentation. Will definitely add a Wiki article with all the details before merging the changes. Thanks! I will take a look at the other project, looks interesting from what I briefly saw. |
thank You! |
Hello,
I'm just starting to use tiedot for an application on a low memory footprint device. The results so far seem very promising!
The current API is definitely usable, but I was wondering if it would be possible to support a more RESTful API? There are a couple of issues that this would solve.
application/x-www-form-urlencoded
content). A RESTful API would use path parameters andapplication/json
encoding only, which would simplify things. Also, unnecessary overhead of URL decoding the documents would be eliminated. For example, in the tutorial a document is inserted like this (lines omitted for brevity):This would instead become something like:
The
v1
prefix makes this a new API version so the existing API can still be supported. The new version would use query path parameters,application/json
content, and restrict to appropriate HTTP verbs. For example:I can offer to help with documentation, but this project is my first foray into golang, so I doubt I could help much with implementation at this point. Thanks!
The text was updated successfully, but these errors were encountered: