-
Notifications
You must be signed in to change notification settings - Fork 80
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
Where to find the REST API for created Things? #373
Comments
I am not quite sure about what you're asking, but if you're looking for a list of operation types allowed in a Thing Affordance you could look at the Thing Description document (precisely here see the op vocabulary term). Basically you can:
|
Ok, I partially got it. It depends on "what" I'm trying to achieve with that particular For example:
Maybe I'm the one that didn't fully understand the Thing Description... Maybe it's the Thing Description itself that gives me this info, but I can't figure it out (some default values that I missed?). For this I'm asking a little help: maybe I'm not the only one that didn't find a reference to this. |
So what is confusing is actually sadly not clearly documented. Depending on the protocol, different op values will map to different methods or "functions" of the protocol. For HTTP, it is as you have understood and it is "documented" here. The rest of the protocols are documented here. What is confusing you and that should be fixed in node-wot is that the default generated TD does not contain the default values and that is not documented nor there is a way to specify this, i.e. the Thing developer cannot say that these values should be present in the forms. |
Awesome. I totally missed this part of the documentation. It clearly says what method uses which type of And you're right, some parts are not well documented, but I think is also part of "our" job: we use it, we got what's good and we open an issue for things that are not good, right? For the rest, I think I'm going to search most common (or draft-standard) patterns to use, just not to completly "reinvent the wheel". Thank you. |
No problem :)
You don't have to use the default values btw, you can simply say how the request should be constructed and the WoT Consumers should understand it. |
@egekorkan I take your comment as an open issue we should look into. Right? |
I think so. I'd say that there should be an option to generate TDs with default or not since there's no option to do it now. The default behaviour could be to generate the defaults since the beginners need more information. |
I think is linked with #424, once we add canonicalization in practice the generated TD would have the default values. What do you think? |
Hello! I'm doing my best to understand all the stuff about Thing Description and WoT. I choose to test this framework over the "Mozilla" one, since ThingWeb has a native support for multiple context values (or at least, it does not overwrite them and I still can retrieve them when asking for the TD of my Thing).
Now, since my future project will require a raw REST API to use (and not a NodeJs / JavaScript based one), I was trying to find some references to where to find all possible operations I could make on a Thing. I don't want to use the API of this library, but the native REST protocol.
Some background. I have a simple bulb, with status (
boolean: true/false
) and atoggle
action (self-explanatory).With Postman I tried to make some blind requests, and I found that this combination works:
GET http://localhost:8080/bulb/properties/status (no extra header/body)
It returns just "
false
" or "true
"PUT http://localhost:8080/bulb/properties/status (with header
Content-Type: application/json
and body set to "raw/JSON"true
)It returns just the HTTP Status.
POST http://localhost:8080/bulb/actions/toggle (no extra header/body, since it doesn't require any param).
It returns just the HTTP Status, but I thing I could make it return anything I want.
GET http://localhost:8080/bulb/all/properties (no extra header/body)
It returns
{ "status": false }
So, are there some docs about all types of GET/PUT/POST/etc... combinations (or, at least, the most common and useful ones)?
And, is there any standard for passing/returning data? Like the just plain
false
ortrue
values seems strange for me.Thank you.
The text was updated successfully, but these errors were encountered: