I have started the Gateway and tried to interact through some HTTP requests sent from VScode thanks to REST Client extension.
What happens is that I successfully perform the login and get the jwt object. But then, even though in the request I specified to keep-alive the session, if I try to get something I result as unauthorized.
Thank you @bfrancis for the help fixing the Authorization header did the trick.
Now I am facing another newbie problem. In the property resource section of the API documentation there is an example for setting a property value, that basically consists in performing a PUT of the object { "property" : value } toward the property’s link.
In my thing description, I have the following properties object:
For version 1.0 (the latest release) that looks correct.
However, if you’re building the gateway yourself from the master branch (which given the Thing Description you pasted it looks like you might be) then the REST API on that branch is in the middle of being migrated to the upcoming W3C WoT Profile standard instead, which means that won’t work.
In the (draft) W3C standard the writeproperty operation in the HTTP Basic Profile just accepts the value as the payload, without being wrapped in an object keyed by property name.
Try this:
PUT http://localhost:8080/things/virtual-things-7/properties/on
Authorization: Bearer hafbhjfbefexsmskxkdmckvrnvrjaewcxshsssamaammxcekefenfenfjjjxmsk
Accept: application/json
Content-Type: application/json
true
Note that the migration to the W3C standard is part way through (the standard is still in draft form) so things are going to be a bit confusing on the master branch for a while.
If you’re interested in the remaining differences from the WoT Profile specification, see the list of issues with the w3c-compliance label on GitHub.
You’ve got the point: I have built the gateway from the master branch. Hence, the request you suggested worked and the response was compliant with the one documented in the draft (i.e., HTTP/1.1 204 No Content).
Unfortunately, I was not able to build and start the 1.0.0 version of the Gateway on my Ubuntu-aarch64 Virtual Machine running on my Mac having an Apple Silicon processor.
Even what I’ve written here fails on that version.
I guess I will take as a reference the draft and the GitHub issues if necessary, and until some other - hopefully working - attempt to do will pop into my head.