How to access OH REST API from Javascript?

Great. For now I do not need to use REST API then. I have some Shelly devices where I might want to poll power consumption using their REST API so I do not have to wait until they push updates to OH. But this is something for later. It is good to know to use sendHttpXRequest Actions when I get to it.

There is a slight mistake in your example, “addGroup” should be “addGroupName”:

ir.getItem("MyItem").addGroupName("OpenItems");

After you pointed me the right way I found this old post of yours with a lot of good information. For some reason I did not come across this before. There is also the information on “addGroupName”:

https://community.openhab.org/t/experimental-next-gen-rules-engine-documentation-4-of-writing-scripts/55963

Thanks a lot!