eclipse-thingweb / eclipse-thingweb/node-wot

Where to find the REST API for created Things?

Open
#373 8 comments 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
TypeScript
Stars
192
Forks
100
Avg merge
3d 2h
Merged PRs (30d)
6

Description

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](https://github.com/WebThingsIO/api/issues/157#issue-781491686)" 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 a `toggle` 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` or `true` values seems strange for me.

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.