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
Leshan server REST API #1533
Comments
This is REST API of leshan-server-demo. This API is not intended to be reused, so of course there is no documentation. You can get look at : |
Thank you for your message! I'm aware that the REST API in the demo Leshan server is not intended for commercial use. In our case, we are utilizing it solely as a testing tool. Our goal is to create new resources in the Leshan server using the REST API, but we have encountered challenges in accomplishing this task. Our existing code is outlined below:
Thanks! |
Yep it seems there is a lot of people who do that. 🤔 Could you described a bit more how you are using it ?
Did you try the tips about :
? Maybe a missing media-type ? |
We have a REST client to perform automated queries, updates, and deletions of resources in the demo Leshan server. While we've successfully managed to update and delete resources, we've encountered an issue in creating new resources, and we can't figure out what is the reason for that.
we did, using the web UI works. However, it doesn't align with our primary use case. Our objective is to automate the process through our client REST API. The web UI requires manual interaction, and it is notably slower.
It is possible, but we haven't managed to figure out what is the problem and the error message we received from the Leshan server lacks clarity in describing the problem. |
The idea is to use Web UI + web browser dev tools to explore the REST API and then you know how to use it in your code.
Share the error message + share a |
Yes, you are absolutely right and this is how we have done it so far but the Web UI does not give the option of creating new resources, right? only new instances. So, when we try to enable a new object using the REST API, for example:
The leshan server returns a 200 OK message with empty payload but the object is not enabled. :/ |
Oh I don't get that. You want to create "ressource" or you wanted to say "resource instance" ? See LWM2Mv1.1.1@core§6.3.6. Create Operation
That sounds strange but again give me a |
sorry for the confusion, I meant "enabling a new object" using the Web UI.
This is a
|
AFAIK, this is not allowed by the LWM2M specification too. |
that is related with the CREATE operation, right? |
Yep, but more generally this has not so much sense to add support of an object just by sending a request.
I was able to reproduce and even if REST API is not intended to be reused current behavior is not so good. I will adapt the code to return a BAD_REQUEST in that case. |
Ok I fixed it with 73916b7 |
@onovo1 let me know if we should close this issue ? |
thanks for such a quick fix!
OK, I understand. So, the current behavior allowed on a server should be to request information and update the already existing objects, right? I think we also got a 200 OK when trying to delete an objects from the server using the REST API, but such an object was never deleted. |
Yep
OK thx for reporting this 🙏 |
I tried that and get Bad Request
Could you provide a way to reproduce ? 🙏 |
Actually, the instance is deleted from the server and the client simultaneously:
Is that the right behavior? Now, I remember, We expected that enabling an object instance on the server using the REST API would exhibit the same behavior as the DELETE operation, enabling the object in the server AND the client simultaneously. |
Yep,
There is no way to enable/disable the whole object at server initiative. |
Is there a way to create a new instance of an enabled object using the REST API, then? |
Yep used by |
I meant, using the REST API. I was just wondering if currently that was possible. |
Yeah it is possible using REST API. Please, let me know is there is something unclear because I repeat myself several time on that point and I don't know how to explain it better 😬 |
Everything is clear now, thanks. :) |
Should we close this issue ? |
yes, please. It would also be beneficial to have a proper documentation for the REST API. I understand that this may not be the highest priority given other important features that need attention, but having the documentation for the REST API would be a valuable addition, and it's unfortunate that the API is currently hidden. |
Yep I totally understand you from a user point of view. So not so much effort was invest in it. Code quality of the demo is much lower than the library one. Even if it seems that there is really a community need behind this : |
Question
Hi,
is there any documentation of the REST API supported by the Leshan server? I couldn't find anything and going through the code to figure out the options is a bit painful.
I found this link but it is not updated and/or well documented with proper examples:
http://robertsrhapsody.blogspot.com/2018/01/eclipse-leshan-rest-apis.html
Thanks!
The text was updated successfully, but these errors were encountered: