Package org.openhab.core.io.rest
Interface WebhookService
@NonNullByDefault
public interface WebhookService
Service interface for requesting webhook URLs that are publicly reachable
and proxied to a local path on this openHAB instance.
Implementations (e.g. the openHAB Cloud addon) register themselves as an
OSGi service. Bindings consume this service via
@Reference to obtain
a public URL that external services can call; the implementation proxies
those incoming requests back to the specified local path.- Author:
- Dan Cunningham - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionremoveWebhook(String localPath) Remove a previously registered webhook for the given local path.requestWebhook(String localPath) Request a webhook for the given local path.
-
Method Details
-
requestWebhook
Request a webhook for the given local path. The implementation returns aWebhookcarrying a public URL that proxies incoming requests to the specified local path on this openHAB instance, together with the instant at which the registration expires.Implementations should treat this call as idempotent when possible: calling it with the same
localPathshould return a stable URL and refresh the expiration.- Parameters:
localPath- the local openHAB path to forward webhook requests to (e.g."/rest/webhook/foo"); must start with"/"- Returns:
- a
CompletableFuturethat completes with the registeredWebhook, or completes exceptionally if registration fails
-
removeWebhook
Remove a previously registered webhook for the given local path.- Parameters:
localPath- the local openHAB path whose webhook should be removed- Returns:
- a
CompletableFuturethat completes when the webhook is removed, or completes exceptionally if removal fails
-