JSON data of entire system


(Josh) #1

I’ve looked through the documentation but didn’t see (or may have missed) this.

I would like to created a json object of the entire system (hub info, devices, states, events, etc) and send it to a 3rd party with httpPostJson.

I understand the httpPostJson side, but am not sure the best way to collect the data to create my data to pass.

Thanks!


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Not “all” of the data is available … there were some “secret” REST-API endpoints posted at one time, and some of them may still work. I’m not going to encourage them, but someone will be sure to paste a link. It’s in the forum if you search hard, I think.

Officially: I believe there are no JSON API’s to the information screens of the API/IDE web pages (http://graph.api.smartthings.com/ide/… ; or the UK equivalent).

Officially: You can fetch various information via a SmartApp; that is, various aspects of the Hub, Location object (not the Account object), and all the public properties of the Device instance objects that the user authorizes to that SmartApp. That includes Events on the above mentioned objects for at most the past 7 days.

TL;DR;
You can’t get all the information you’re may be hoping for, but you can get quite a bit … using a single SmartApp.


(Josh) #3

Thanks for the response.

Sounds like I will need to push data on a more granular level.

If I didn’t know what hardware was connected to the hub, is there a way to push a list of all devices and some basic info on them? (State, temp, battery, etc).


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

For their security model, SmartThings requires the user to specifically authorize each and every Thing that a SmartApp can access. This includes both regular internal SmartApps and web services / REST-API Endpoint Smartapps.

So you have to include input() selection options for the common denominators of all the Capabilities that cover all possible Devices. Usually “Capability Actuator” and “Capability Sensor” is sufficient… But not always.

We hope SmartThings would/will (ahem, officially) provide a REST-API / JSON output that matches the list views of the IDE for a logged in Account, but not currently.


(Brian Meissen) #5

Hi all - very interested in this topic. Are there no other SmartApps which are published to the public which simply outputs the device state to JSON? I can’t imagine that there’s nothing out there already for this. I’m in the same boat as the OP, I would just like to have a full JSON output like Quirky/Wink’s get devices which lists all my devices out.

I’m very new to SmartThings, but if we had the ability to output JSON I could integrate SmartThings with Wink in a centralized dashboard…


(Jody) #6

A full API is something we are definitely interested in having. Once we have core stability and added resources, you will see more movement in that direction. In the mean time, I think this might help you along.


(Brian Meissen) #7

Thanks for the reply, Jody! I’ll definitely give this a try asap! One thing I noticed, though, is the atlassian website is restricted and new users can’t register. Regardless, will give this a try and really thank you for putting it together!


(Jody) #8

Yeah those are our internal design docs. If you look at the code, there is pretty good documentation in there. I will try and copy from those internal docs into the public repo when I get a chance.


(Brian Meissen) #9

Hey Jody - sorry for the newb question – which token should I be using? I saw your mention of using Postman to get the token. I tried my client secret and the API token and neither worked.


(Jody) #10

Note the “type” section is set to OAuth 2.0. Your ID and SECRET are used to gain the token.


(Brian Meissen) #11

Thanks a bunch Jody, really appreciate it!