LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeCastleOS API

Information, FAQs, Q&As, and everything else related to the CastleOS API can be found here

API Messages in this topic - RSS

Michael Wallace
Michael Wallace
Posts: 52


12/12/2015
Michael Wallace
Michael Wallace
Posts: 52
I see the update Chris. Does this release have the new API exposed? Is it in the same location as before? Thanks.
0 link
Kevin Mathews
Kevin Mathews
Posts: 138


12/12/2015
Kevin Mathews
Kevin Mathews
Posts: 138
Michael Wallace wrote:
I see the update Chris. Does this release have the new API exposed? Is it in the same location as before? Thanks.



You see what update where?
0 link
Michael Wallace
Michael Wallace
Posts: 52


12/12/2015
Michael Wallace
Michael Wallace
Posts: 52
New Core Service available for download.
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


12/12/2015
Phil Hawthorne
Phil Hawthorne
Posts: 400
Michael Wallace wrote:
I see the update Chris. Does this release have the new API exposed? Is it in the same location as before? Thanks.


lol this is becoming a joke. No mention of the new API.

If the new API IS released, then this must mean there's no supporting documentation to go with it.

This raises another question I'm sure I've asked before. Will there be documentation available for the API and drivers? Oh, and if by documentation you mean the same level as "custom scripting" is documented, that's not documentation. We want to know what functions/methods exist for us to call, how we call them (REST over HTTP? C library, Indian rain dance and cross our left toes?).

Why are you releasing new devices and protocols like Zwave Plus before the new device drivers API is available? In your Kickstarter campaign selling the CastleHub, you gave the impression that CastleOS uses the same device drivers that will be exposed to us for creating our own drivers.

CastleHub Kickstarter wrote:
The API features complete access to the Core Service, including access to retrieve and manipulate all smart devices, groups, scenes, events, and more. In fact, it features everything you need to build a custom UI to interface with CastleOS, our own UIs use the same API!


If this isn't the case, then how will the community be able to create support for other devices and protocols, on the same level playing field as core CastleOS protocols? With this limitation, whatever the community creates will be severely disadvantaged and limited.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


1/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Hey Phil, I apologize for and understand your frustrations. Many times I've been on the other side of this.. Please know we're committed to delivering the best product we can, and not releasing it until we are confident we achieved our goals for the end user experience. I know everyone is eager to get the latest features, but we have to ensure we release them in a measured and reliable way. To that end we've rolled out quite a few of the features you've been waiting for, with the last being the rest of Z-Wave Plus and the the API features for community-generated device and protocol drivers (the rest of the API features have been released).

We'll have quite a bit coming this month smile
0 link
Michael Wallace
Michael Wallace
Posts: 52


2/10/2016
Michael Wallace
Michael Wallace
Posts: 52
Any update on 2.0 Chris?
+1 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Today's release included the ability to directly access devices, groups, and scenes, and control them. The last piece of the total "2.0 API" is the custom drivers, and we're working on finalizing that now that the rest of this is done smile
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Chris Cicchitelli wrote:
Today's release included the ability to directly access devices, groups, and scenes, and control them. The last piece of the total "2.0 API" is the custom drivers, and we're working on finalizing that now that the rest of this is done smile


Fantastic. Something that has been missing!

Your post raises a few important questions

1. How does one control the devices/groups/scenes?
2. Is this well documented?
3. Are there examples?
4. Can devices/groups/scenes be controlled via a HTTP API? Or is it only via a C# script and black magic?
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
"Can devices/groups/scenes be controlled via a HTTP API? Or is it only via a C# script and black magic?"
That's always been possible...now the same feature is extended to internal scripts.

As for documentation, we're still working on that. We're also working on a "mini SDK" that you can use as a reference in Visual Studio. Hopefully end of weekend on that...
0 link
Tommy Long
Tommy Long
Posts: 218


3/2/2016
Tommy Long
Tommy Long
Posts: 218
Would love to see an example for how to http control a device, that would be very fantastic!!
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Controlling groups and scenes are SUPER easy and I can give you a script example for that, access all the device properties, changing settings, etc. is a bit more complicated and really should have a properly example...
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Chris Cicchitelli wrote:
"Can devices/groups/scenes be controlled via a HTTP API? Or is it only via a C# script and black magic?"
That's always been possible...now the same feature is extended to internal scripts.


Care to enlighten us on how we can do this?
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Documentation is built in, if you use a REST or WCF discovery tool, it will all put up automatically. You have Visual Studio installed right? A WCF tool is built in. Do a search on the start menu for WcfTestClient.exe. After it opens, right click My Service Projects and select Add Service. Then enter http://localhost/CastleOS/service

You'll see two entries for each, ignore the ones with red Xs, those are the REST versions of each function...
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Chris Cicchitelli wrote:
Documentation is built in, if you use a REST or WCF discovery tool, it will all put up automatically. You have Visual Studio installed right? A WCF tool is built in. Do a search on the start menu for WcfTestClient.exe. After it opens, right click My Service Projects and select Add Service. Then enter http://localhost/CastleOS/service

You'll see two entries for each, ignore the ones with red Xs, those are the REST versions of each function...


Can I substitute localhost with the IP address of the CastleHUB? I have visual studio installed on my PC, not CastleHUB.

The ones with the Red X's, if they are REST, I can call them via HTTP?
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Yes and yes... whatever platform you're developing on will probably have a stock way to access a REST API...
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Chris Cicchitelli wrote:
Yes and yes... whatever platform you're developing on will probably have a stock way to access a REST API...


Well, I should be able to call the endpoints in my browser if the API is truly RESTful. The only variable will be how CastleOS handles authentication. Do I need a token? Username and password in HTTP Basic Auth? Username and password POSTed? Or username and password in the URL?
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Actually, I honestly don't know the answer to that. I didn't write the REST API, so I'm not sure how to implement it. I did write the WCF side of it can help with that though. Otherwise I'll have to ask our team member who wrote it to build a guide to use it smile I know on the WCF side of it, it uses a username and password, where it's just setting the ClientCredentials:


ios.ClientCredentials.UserName.UserName = HttpContext.Current.Request.Cookies["CastleOSMembership"]["USERID"].ToString();
ios.ClientCredentials.UserName.Password = HttpContext.Current.Request.Cookies["CastleOSMembership"]["PASSWORD"].ToString();

(ios in this case is just a shorthand for os interface, not for Apple's iOS)
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Once you can answer that, you will start to open up CastleOS to a wider audience of devs that can't use WCF. For myself, WCF is limiting because I need it to run on a windows machine, has to be in C# etc.

With REST, I can use virtually any language I want. You open up CastleOS from just to windows devs, to devs comfortable on Linux, Mac etc. They can use any language they feel comfortable coding in: PHP, NodeJS, Javascript, Ruby, Python, .NET. If I was you, I'd try get that REST API in the wild ASAP.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/2/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
I'll have him build an example...what language do you think it should be in? Javascript?
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/2/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Yeah Javascript is fine.

If you can get it into Javascript, I'll try convert it into PHP and make an SDK for it in that.
0 link