What is an "Endpoint"?

The latest firmware release, 2.3.9.176 has lots of new "Endpoints".
Can someone please explain, in semi-technical language, what is an Endpoint? When and how do I use one?

Think of them as means to access information or functions via an HTTP GET or POST call.

2 Likes

In my time, we called them hyperlinks or later, URLs, and Hubitat offers many dozens of different ones that either cause things to happen on the hub, or extracts information externally.

The most benign and easy-to-understand set of endpoints are associated with Maker API, whose docs I link you to here. Most require slight modification to target the device, app or service you need to access.

Endpoints are broadly classified as either "Local" (meant to work while connected to the same LAN and subnet as your hub) vs. "Cloud" (for remote connections such as a mobile device or PC in a different location).

Hope this helps!

4 Likes

To take @libra_sun_2000 's analogy and bend it a different way.... When you click on a web link say for a local news web site, your browser will typically receive back a mixture of HTML and related files that all make up the page ultimately displayed on screen. This can include images, scripts and other types of files that your browser knows how to interpret and present on screen.

An endpoint technically isn't really any different, at least in my eyes. You can just as easily open the Maker API URLs or even the endpoints talked about in the release notes and in most cases your browser will present some text on screen that may (or may not) make some sense to you. The difference is the intended use case for these. What people will commonly refer to as and endpoint is typically to be used by another system that knows how to call the endpoint and interpret the (typically) data it returns, whereas something like a link to a product on Amazon is intended to be read by and rendered on screen by a browser for a human to consume.

It's shorthand for API endpoint, and that word implies that, even though it may look like a normal URL to you (the kind you would put in your browser's address bar), you would typically need to know other things to use them in a script/program/app, such as the method (GET, POST, ...), authentication, headers, etc.

Wild speculation : a lot of the new endpoints in 2.3.9.x look like they would be useful for fleet management.

Thanks, all.

So are Endpoints the kind of thing used by @thebearmay in his excellent Hub Information Driver?

And are API's and Endpoints pretty much the same thing?

1 Like

I have quite a few endpoints in there and other projects. The closest thing to an API is MakerAPI, but you can do a lot with the endpoints to provide additional functionality.

It might seem intimidating, but quite simple and very useful if you want to send a device command from iOS shortcuts or even a web link, since you're using a regular URL and no coding is required.

Just install the Maker API app and you'll get a page of generated URLs. For example you'll see a cloud link for device control like the first line below. Just add the device to maker API app, grab the device ID and command from the device page, drop them in, and you're up and running.

https://cloud.hubitat.com/api/k35iko2e-1cbf-8765-7f34-fba55dyrhikhj/apps/934/devices/[Device ID]/[Command]?access_token=6j7k2t2l-4j7l-4js7-2le9-7h2k0s7l2h8v
https://cloud.hubitat.com/api/k35iko2e-1cbf-8765-7f34-fba55dyrhikhj/apps/934/devices/2010/on?access_token=6j7k2t2l-4j7l-4js7-2le9-7h2k0s7l2h8v

(No access tokens were harmed in the making of this post)

4 Likes

In fact searching his GitHub is probably the easiest way to find out what’s available in terms of endpoints :stuck_out_tongue_winking_eye:

The endpoints we’re discussing are part of the hub’s web API. There’s a Groovy API also (covered in the documentation). Both are available to apps/drivers running on the hub. Only the web API is accessible externally.

1 Like

The examples @brad gives bring up another point.

The hub exposes web API endpoints, but unless you have your hub directly on the internet none of them are reachable outside of your local network, they sit behind a router that most likely does NAT/firewall.

HE provides a free service that forwards (some, not all) the web API “calls” (requests) to your hub: those are the ones with a base URL pointing to cloud.hubitat.com.

Dashboards and such are accessible outside your network because of this service. Maker API is one way to generalize this use to your specific devices and apps.

One of HE’s best features IMO.

I'd add that Rule Machine (along with its associated API) similarly offers its own form of endpoints, which can act as Triggers, to Run/Pause rules, and to set Variables. Woefully under-appreciated feature IMHO!

1 Like