Rate Limiting Annoucement


(Jeff Beck) #21

Only for API calls you will get headers back that you can act on but SmartApps themselves are not executed so you can’t act on the rate limiting.


(Alex) #22

When a SmartApp is actually executed, can I see the state of current time window, how many seconds remaining and the current event count?


(Jeff Beck) #23

As Ryan said above it is not available in our current implementation. The only place that exposes the rate limit details at this time are the headers.


(Alex) #24

So, is the only way to query the remaining allowance is for a SmartApp to make a request to itself and analyze the headers?

This seems a bit… inconvenient.


(Alex) #25

I didn’t know Device Handlers are exposing any web APIs. Could someone point me to documentation for that?


#26

Is this it? In the cloud connected device types doc:

http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-cloud-connected-device-types/building-the-device-type.html


(Alex) #27

No, there is no mention of exposing web APIs. It only documents some outbound HTTP commands.


(Jim Anderson) #28

Device handlers can expose endpoints via a mappings block like SmartApps. The SmartApp Web Services guide applies to device handlers as well, in that they can define a mappings block to expose endpoints.

It’s not clearly documented that this applies to device handlers, or why you would need to do this, at the moment. It’s on the list. Sorry.


(Alex) #29

If I could expose device handlers endpoints, how would I enable OAuth for a device handler to get client id/secret?
If I can’t then why is there a limit on something that can’t be done?


(Andrew Urman) #30

OAuth is for authentication, not API calls. You don’t need OAuth to make web calls. It makes perfect sense for them to also rate limit that.


(Alex) #31

I thought one would need to authenticate in order to be able to call APIs on a device.

Either way, I would like to know what the mechanism is and where it is documented.


(Andrew Urman) #32

Authentication can be done elsewhere and passed to the handler or not at all.


(Alex) #33

Where’s the API doc for this functionality? Samples? Anything?


(Jim Anderson) #34

We don’t have good documentation at the moment for using mappings in a device handler specificaly. You can find some information about configuring the mappings to handle inbound requests in the SmartApp Web Services guide. There’s also an example SmartApp that exposes web APIs [here][2].

We do have in our backlog work to document web services better overall, including in device handlers.


Can I make a virtual device that has an oAuth REST endpoint?
(Alex) #35

@Jim, is there any documentation or sample for using mappings in a device handler?

Once I stick mappings in a device handler, how do I interface with it?

You keep referring me to SmartApp web services guide.


(Alex) #36

Andrew, you are such a tease! You know something and you are not telling.


(Jim Anderson) #37

No. There is no documentation currently for specifically using the mappings in a device handler. We are aware of that gap and it is in our documentation backlog to address.


Can I make a virtual device that has an oAuth REST endpoint?
(Alex) #38

@Jim, is the time window synchronous across the cloud?


(Yves Racine) #39

Hello @April, with this new policy, is there a limit on the number of http requests a smartapp or device can send?

I now get the following error message sometimes:

groovyx.net.http.HttpResponseException: Too Many Requests

Please let me know.
Regards.


(Jim Anderson) #40

There are no limits on outbound requests. You may want to check the rate limiting policy on the API you are calling to see if that’s being hit.