Http API Call best practices

I am working on a mobile device library which connects to Vera over http. To minimize the amount of data pulled, I am pulling sdata and calling finddevice for each device to retrieve deviceType information. Vera chokes when I make multiple finddevice calls. Is there any best practice on making multiple http api calls? How long should I wait between each call to keep Vera responsive?

Does it help if I check Alive before each call? Or will it make it worse?

Thanks,

Ercan

You may want to use user_data and lu_status. It will be less stressful on the system and calling user_data only when needed.

  • Garrett

user_data returns around 445K of data and lu_status returns 201K. I was hoping to utilize sdata which returns 18K and make finddevice calls. This implementation will be for .Net Micro Framework microcontrollers which runs on limited amount of memory.

I know it is not the best option. But can I implement it without choking Vera?

Not really. You’ll have to make each call have a delay of a second or two. You only need to call user_data one and all subset calls could be with lu_status passing the load time and version to get the changes that happened from the last call. Sdata is limited and you’ll soon realize it does not provide everything you need.

  • Garrett

Is it possible to submit feature requests? For example, a single finddevice call with no parameters can return all id, devicetype and udn for all devices.

For now, I have added a retry to finddevice call. If the call fails, I wait for 10s and retry.

With this implementation, it takes 33 seconds to retrieve sdata and make 84 finddevice calls. If I retrieve the same information from User_Data it takes, 2.2 seconds.