I’ve been getting the API to work in a Google Spreadsheet Script and I’ve been working down all the examples in the API documentation and so far I’ve gotten a proper response back with the info I need. The last one I got to work was /public/zone/:id. (which the documentation example was wrong, “public/device/” should be “public/zone/”)
What I can’t get to work is /public/zone/start. Any idea how I would format that to work out of Google Apps Script?
This works and I get a response back:
function ZoneInfo() {
var APIKey = XXXXX;
var ZoneID = “1b9a8312-d9b3-4ffd-a0c5-6509c2a2c3bf”
var url = “https://api.rach.io/1/public/zone/”+ZoneID;
var headers = {
“contentType”: “application/json”,
“headers”:{“Authorization”: "Bearer " + APIKey}
};
var response = UrlFetchApp.fetch(url, headers);
var data = JSON.parse(response.getContentText());
Logger.log(data);
}
Result:
[20-08-18 17:06:39:328 PDT] {customSlope={sortOrder=0.0, name=ZERO_THREE}, lastWateredDate=1.597777682E12, customNozzle={inchesPerHour=1.0, name=ROTOR_HEAD}, rootZoneDepth=6.0, id=1b9a8312-d9b3-4ffd-a0c5-6509c2a2c3bf, yardAreaSquareFeet=500.0, runtimeNoMultiplier=2239.0, availableWater=0.17000000178813934, customSoil={name=LOAMY_SAND}, runtime=2239.0, managementAllowedDepletion=0.5, scheduleDataModified=false, customCrop={name=Cool Season Grass, coefficient=0.800000011920929}, wateringAdjustmentRuntimes={2=2799.0, 3=2239.0, 4=1679.0, 5=1120.0, 1=3359.0}, imageUrl=https://prod-media-photo.rach.io/34e18bca-535d-443e-a7c4-b203ec1484cc, zoneNumber=1.0, name=Front House, saturatedDepthOfWater=0.56, fixedRuntime=0.0, enabled=true, maxRuntime=10800.0, depthOfWater=0.51, efficiency=0.699999988079071, customShade={name=LOTS_OF_SUN}}