I am asking that is there any way or example for me to add custom Restful API endpoint from other programming language on top of openhab Restful API so that I can call it outside through openhab cloud over Internet
I know that openhab is powerful and may can add what we need but no one good at all programming languages. I just want to know the possibility and example from here. Thanks
If I understand your question right, then the answer is no. Restful API endpoints are definded in openHAB core and there should be no need to add/change those.
Please check the api documentation in MainUI → Develper Tools → API.
You can see the comlete list of endpoints and will find curl examples how to use these endpoints.
Yes, I want to add restful api endpoints on top of openHAB restful API. For openHAB restful api, I know how to use these endpoints, thanks your information.
I have a raspberry pi act as server and installed openHabian. The openhab cloud is useful and powerful that I can call openHAB APIs from outside without setup port forward or VPN. And I have other integrations with OH so that I want to utilize it if it can also call my own restful api through openhab cloud…
The answers here are correct but there are some hacky ways you might be able to get around that. Ultimately though I’d call that an abuse of the intended use of the openHAB Foundation’s provided instance of the openHAB Cloud Server (i.e. myopenhab.org).
But things you can do include:
somehow implement your API in JS in an HTML page that you put under $OH_CONF/html. These web pages wll also get proxied. Often you’'ll run into COR problems though with this approach.
use Items and the HTTP binding and/or rules to act as a proxy between OH’s REST API and your custom APIs. From outside you’'d command an Item which will trigger the HTTP binding o rule which will make the proper REST API call on your custom service.
@rlkoshak Thanks your response and suggestions! You are creative and helpful. I have my own server to hold openHAB Cloud service so I would not to abuse the usage of openHAB Foundation’s provided instance of the openHAB Cloud Server
great to know that you pointed out the static page folder also will get proxied.
the second method also is a good direction for me to try and think more. But how about the response in same http request? I think it will be great if we can solve out @rlkoshak
I have read it long long time ago but don’t recall it from my memory in this situation. Thanks your information and the idea on it. It looks like similar method using HTTP binding but great to heard that and now I have some idea to try it. Thank you!