<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=2854636358152850&amp;ev=PageView&amp;noscript=1">
7 min read

SBA 259: APIs for Building Automation

By Phil Zito on Jul 12, 2021 6:00:00 AM

Topics: Podcasts

In this episode of the Smart Buildings Academy Podcast we will discuss what API's are, how they can be used, and why they are important for BAS professionals to understand.

Click here to download or listen to this episode now.

Resources mentioned in this episode

itunes-button-300x109
Subscribe via iTunes

stitcher
Subscribe via Stitcher

Transcript

Phil Zito 0:00
This is the smart buildings Academy podcast with Phil Zito Episode 259. Hey folks, Phil Zito here and welcome to Episode 259 of the smart buildings Academy podcast. And in this episode we are going to be talking about API's for building automation. We're going to talk about what API's are, we're going to talk about what they aren't, we're going to talk about how they're used in building automation. And by the time you're done with this short episode, you will have a solid understanding of API's. Alright, so with that being said, like always, everything that is referenced in this podcast can be found at podcast, smart buildings, academy.com, Ford slash 259. Once again, that is podcasts at smart buildings academy.com Ford slash 259. And this episode is sponsored by our it for be as professional as version two course there is still time to get into the early access, the price has gone up, and the price will continue to go up. As we get closer to completing the course we're about 50% done recording the course. And this course is going I was sitting there talking to my team on our Friday meeting and I was saying, holy crap, this course is going to be absolutely amazing, there's going to be nothing else like it in the market. So if you are looking for a course that is going to basically just teach you what you need to know about it. So you could do your job. And let's face it, folks, it is everything nowadays in building automation. So if you're looking for that course, that is going to teach you everything you need to know so that you can just go out and be that it expert and get that promotion, get that raise close that deal, you know, finish that project, then you need to check out and enroll in it for VA s professionals version two. And you can do that at podcast smart buildings academy.com, forward slash 259. Okay, so what are these things called API's? API stands for application programming interfaces. And I find a lot of people really struggle with API's. And they just kind of struggle to wrap their minds around them. And here's what I want to tell you. Okay, have you ever written a program for building automation in your controller software? You've written the program he made sure it works. And then you go and you compile it, right? you compile the program so that it can actually run? That's what compiling does. And then you send that program to the field controller. And that field controller, may be that program has network points that are discoverable, right, you have like maybe a, an outdoor air temp global SharePoint that's discoverable, and you map that point to other controllers. You My friends are dealing with what is affectionately known as an API. Let's talk through that. So it's an application. In our case, it's an application that's running on a field controller. But in building automation, maybe it's a weather station, maybe it's a lighting system, but it is an application that is running. And it serves a purpose, typically, to control the lighting system to monitor the weather to run a program in the HVC system, etc. Right? So we've got an application. And within that application, there's programming, there's functions, right? Like, let's think of the weather station, maybe we want to get the weather, right, we want to get the weather for a zip code. Maybe when we want to get the humidity for a zip code, maybe we want to get the historical or future weather forecast for the week. That is all part of a programmatic function. In the case of the weather station, what we're doing is we're sitting there and we're saying, Okay, let's give me this. So we pass a query, right, we have a URL, typically, for API's that we write to, or an IP address that we write to and we pass through a query function. In this query function is something like get address, or get weather and the parameter we pass through, maybe the zip code. In the case of building automation, maybe we're doing a read property using the back net API. Yes, they are API's, they are application programming interfaces into the back Net Applications. And we're running the get property or read property rather service from back net. And so we read this property right, and that's all part of the programming. And then we have the interface and the interface is the end point. It is the point at which we interface with the programming and the application. So we have an application. Within this application. There are certain functions that we can execute. We execute them by calling on the functions through the interface or endpoint. Hence, API Application Programming Interface. Now, what does this look like? So from a weather station perspective, oftentimes we'll have things like Weather Underground, or etc. and we can call against their API's. And so we will write either to the domain name, which is the semantic name, so weather.com, Weather Underground, calm, etc. Or we will write to the IP address, typically, we're writing to the DNS cement semantic name, because the IP addresses can change.

But we write to that name. And once we write to that name, we call on functions. And you see this all the time when you do like a Google search or something like if I go over to my computer that I'm recording right now. And I go into a Google search, and I just searched the color red. What I'm going to see is google.com, forward slash search, question mark, q equals color plus red. And basically, what's happening there is I am doing an API call against the search program that is in Google. So you can start to see it's relatively simple. And then Google, in this case, is returning a bunch of HTML results. But in our case with API's will often get different results based on the service types. In the case of back net, we get a certain specific response, based on the protocol. In the case of most API's, we will get what's called a JSON JavaScript Object Notation, response, which for those of you who are familiar with haystack and the key value, methodology, think about that, because that's essentially what's going on right, we have this key value methodology in JSON. So it'd be like weather, or city equals Houston, temperature equals 72. Humidity equals 60%. And we get this string response. And we can get that in JSON, XML, string, etc. There's many different formats, we can get our API responses and but suffice to say, we will get a response. Now API's will usually use keys to make sure that like, of the billions of people that could be calling against the endpoint, this person can actually have the rights to call against the endpoint. So typically, you authenticate your call against the endpoint and the endpoint will give you a response, you'll take that response into your program, most of the modern VA s systems have a way to consume HTTP API's nowadays. That being said, if they don't, you can write a script that will actually consume that and type it over to a specific protocol. When I say type, I'm talking about data adaption, I'm talking about converting one format of data to another that can then be absorbed by a system. So if we're pulling in some JSON data, but we need to write it to a BACnet system, we need to type it to BACnet objects. And we go through that in our system integration bootcamp course, we also briefly cover it in our it for VA s professionals course as well, where we talk through how to do that. But it's something that is becoming less and less required, because it's built into most modern building automation systems nowadays, because they realize how important it is to be able to consume HTTP API's. So there you have it, folks, a brief overview of API's for building automation systems. In our next podcast episode, we're going to talk about how to work with API's and VA s. And you're going to learn how do you go and actually implement an API? How do you actually work with it in a building automation system? Thanks a ton for listening. I hope you enjoyed this episode. I look forward to talking to you in the next episode. Like always, you can check out everything at podcasts, smart buildings, academy.com Ford slash 259. Thanks a ton and take care


Phil Zito

Written by Phil Zito

Want to be a guest on the Podcast?

 

BE A GUEST