Example code

Let’s get coding for the environment

Congratulations. You’re about to get familiar with what we think is the most exciting source of data available for the Internet of Things. With the Unity API the Internet of Things expands for the first time into environmental conservation—an area where arguably smart technology is needed most. Welcome to coding for the environment. Welcome to the Smart Outdoors.

Getting Started

The Unity API is possibly the most powerful public API for the environment, and getting started with it might be a bit overwhelming. So let’s first learn the basics, such as what tools to use, how to make your first API request and what to expect as a response.

Getting Started

Gardening Projects API

One of the wonderful things you can do with the Unity API is map a landscape and track its water needs over time. To do this you’ll need to start with a project—the container of everything related to your landscape. The Gardening Project API lets you create and manage projects.

Gardening Projects API

Gardening Regions API

Once you have created a project for your landscape, you can map every plant or plant group in it. Each plant that you map (either an individual plant or an area of similar plants) is captured as a region on the map. The Gardening Regions API lets you create and manage the regions for your project.

Gardening Regions API

Atmosphere API

Want weather for your landscape location? The Atmosphere API has you covered, with daily and hourly historical, current and forecast weather. You have access to everything from sunrise and sunset times, to wind, humidity and pressure, to solar irradiation and evapotranspiration. The atmosphere API will get you weather data for any time and location within the U.S.

Atmosphere API

Weather Summary API

Having weather data in hourly increments is great, but if you’re looking for a yearly average you’ll need a lot of that hourly data and a lot of number crunching. That’s where the Weather Summary API can help. It can compute things such as the summer dry spell (the longest consecutive period without rain in the year), sunshine hours (total daytime hours without cloud cover for the year) and the total amount of rain for the year.

Weather Summary API

What’s next

Once you’ve gone through all of the above code examples, you’re ready for the full API specification. If you need help at any time, we’re waiting for you in the discussions section.

Now let’s build something amazing.