Controlling zones with API
I'm trying to use the API to control individual zones on my mini-8. I'm a novice/newbie at this so my knowledge is a bit limited but here's where I'm at:
I've reviewed all of the API documentation and have been able to login to my mini-8 from terminal using curl. Once I get the access token, I can then run various GET statements and have the unit respond. My problem is with POST statements; Apart from the login, I cannot get anything to work. I'm trying to turn on a zone using the following command in terminal:
curl -X POST -k https://192.168.1.8:8080/api/4/zone/2/start?access_token=16f25c02669e9ba21127d80efd2a94928a880a98ff56f38ceab924c8
I get the following response:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>411 - Length Required</title> </head> <body> <h1>411 - Length Required</h1> </body> </html>
Does the mini-8 (hardware version 2) support this command? The API documentation states "Start watering zone with id Available on 1st gen. Response: "statusCode", "message"." Does this mean this command is ONLY available on 1st gen hardware or does it mean that it works on first gen hardware as well as new hardware?
If the above doesn't work on the mini-8 how do I turn on or off a zone using Curl?
Any help would be greatly appreciated!
-
Official comment
You will need to specify a time to run, so you need to add:
--data "{\"time\": 60 }"
to your curl command.
Actually you have curl examples on the API documentation: http://docs.rainmachine.apiary.io/#reference/zones/zoneidstart/post (see the right hand console)
curl --include \ --request POST \ --data-binary "{ \"time\": 60 }" \ '
https://private-bd9e-rainmachine.apiary-mock.com/api/4/zone/{id}/startComment actions
Please sign in to leave a comment.
Comments
1 comment