NAV
Python nodeJS

Flower Power Cloud API

Welcome to the Flower Power Cloud API !

You can use our API to connect to the Flower Power Cloud, and retrieve your sensors’ data from it.

You can also receive alerts like those in the Flower Power mobile app.

we advise you to use requests package, it can be installed using pip : pip install requests

  _          _ _
 | |__   ___| | | ___
 |  _ \ / _ \ | |/ _ \
 | | | |  __/ | | (_) |
 |_| |_|\___|_|_|\___/     _
 __      _____  _ __| | __| |
 \ \ /\ / / _ \|  __| |/ _  |
  \ V  V / (_) | |  | | (_| |
   \_/\_/ \___/|_|  |_|\__,_|
see github repo :
https://github.com/Parrot-Developers/node-flower-power
https://github.com/Parrot-Developers/node-flower-power-cloud

Authentication

import requests
from pprint import pformat  # here only for aesthetic

# First we set our credentials
username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'

#from the developer portal
client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_SECRET'

req = requests.get('https://apiflowerpower.parrot.com/user/v1/authenticate',
                   data={'grant_type': 'password',
                         'username': username,
                         'password': password,
                         'client_id': client_id,
                         'client_secret': client_secret,
                        })
response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

# Get authorization token from response
access_token = response['access_token']
auth_header = {'Authorization': 'Bearer {token}'.format(token=access_token)}

# From now on, we won't need initial credentials: access_token and auth_header will be enough.

This should returns JSON structure:

{
    "access_token": "YOUR_ACCESS_TOKEN_",
    "expires_in": 2592000,
    "refresh_token": "YOUR_REFRESH_TOKEN"
}

Flower Power Cloud uses API keys to allow access to the API. You can register a new API key at our developer portal.

Flower Power Cloud API expects for the ‘access_token’ and 'auth_header’ to be included in all API requests to the server.

HTTP Request

GET https://apiflowerpower.parrot.com/user/v1/authenticate

Query Parameters

Parameter Description
grant_type should be set to ‘password’
username replace with your username
password replace with your password
client_id replace with your client_id from credentials
client_secret replace with your client_secret from credentials

User API

Get profile


import requests
from pprint import pformat  # here only for aesthetic

# Set your own authentication token
req = requests.get('https://apiflowerpower.parrot.com/user/v4/profile',
                   headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN_'})


response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

This should returns JSON structure:

{
 "errors": [],
 "server_identifier": "YOURS",
 "user_config_version": "YOURS",
 "user_profile": { "dob": "",
                   "email": "YOURS",
                   "ip_address_on_create": "YOURS",
                   "language_iso639": "YOURS",
                   "notification_curfew_end": "YOURS",
                   "notification_curfew_start": "YOURS",
                   "pictures_public": "YOURS",
                   "tmz_offset": "YOURS",
                   "use_fahrenheit": "YOURS",
                   "use_feet_inches": "YOURS",
                   "username": "YOURS"
                  }
}

HTTP Request

GET https://apiflowerpower.parrot.com/user/v4/profile

Query Parameters

No parameters.

Obtain version info


import requests
from pprint import pformat  # here only for aesthetic

# Set your own authentication token
req = requests.get('https://apiflowerpower.parrot.com/user/v1/versions',
                   headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN_'})


response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

This should returns JSON structure:

{
 "errors": [],
 "garden_status_version": "YOURS",
 "server_identifier": "YOURS",
 "user_config_version": "YOURS"
 }

HTTP Request

GET https://apiflowerpower.parrot.com/user/v1/versions

Query Parameters

No parameters.

Sensor Data API

Get Samples for Location



import requests
from pprint import pformat  # here only for aesthetic

location_identifier = 'eg9dnEtyHy589153XXX'

# Set your own authentication token
req = requests.get('https://apiflowerpower.parrot.com/sensor_data/v2/sample/location/' + location_identifier,
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN_'},
    params={'from_datetime_utc': '2014-03-01T14:42:42Z',
            'to_datetime_utc': '2014-04-13T06:30:00Z'})

response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

This should returns JSON structure:

 {"errors": [],
  "events": [],
  "fertilizer": [{"fertilizer_level": "YOURS",
                  "id": "YOURS",
                  "watering_cycle_end_date_time_utc": "YOURS",
                  "watering_cycle_start_date_time_utc": "YOURS"}],
 "samples": [{"air_temperature_celsius": "YOURS",
               "capture_ts": "YOURS",
               "par_umole_m2s": "YOURS",
               "vwc_percent": "YOURS"}],
 "server_identifier": "YOURS",
 "user_data_version": "YOURS"
 }

HTTP Request

GET https://apiflowerpower.parrot.com/sensor_data/v2/sample/location/:location_identifier

Query Parameters

Parameter Description
from_datetime_utc UTC datetime start, optional
to_datetime_utc UTC datetime end, optional
include_acknowledged returns all open and closed events, optional
resolution DAILY. from/to mandatory when resolution present. Time components of from/to ignored when resolution present

Obtain Sync Data

import requests
from pprint import pformat  # here only for aesthetic

# Set your own authentication token
req = requests.get('https://apiflowerpower.parrot.com/sensor_data/v3/sync'
                   headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN_'})

response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

This should returns JSON structure:

{
 "errors": [],
 "locations": [{ "avatar_url": "YOURS",
                 "display_order": "YOURS",
                 "ignore_fertilizer_alert": "YOURS",
                 "ignore_light_alert": "YOURS",
                 "ignore_moisture_alert": "YOURS",
                 "ignore_temperature_alert": "YOURS",
                 "images": "YOURS",
                 "in_pot": "YOURS",
                 "is_indoor": "YOURS",
                 "latitude": "YOURS",
                 "location_identifier": "YOURS",
                 "longitude": "YOURS",
                 "plant_assigned_date": "YOURS",
                 "plant_nickname": "YOURS",
                 "sensor_serial": "YOURS"}],
 "sensors": [{ "color": "YOURS",
               "firmware_version": "YOURS",
               "nickname": "YOURS",
               "sensor_serial": "YOURS"}],
 "server_identifier": "YOURS",
 "user_config_version": "YOURS"
 }

HTTP Request

GET https://apiflowerpower.parrot.com/sensor_data/v3/sync

Query Parameters

Parameter Description
include_s3_urls Return the locations image urls rather than the “id”, optional

Obtain garden location statuses

import requests
from pprint import pformat  # here only for aesthetic

# Set your own authentication token
req = requests.get('https://apiflowerpower.parrot.com/sensor_data/v4/garden_locations_status',
                   headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN_'})

response = req.json()
print('Server response: \n {0}'.format(pformat(response)))

This should returns JSON structure:

{
 "errors": [],
 "garden_status_version": "YOURS",
 "locations": [{"air_temperature": {"done_action_timedate_utc": "YOURS",
                                      "gauge_values": { "current_value": "YOURS",
                                                        "max_threshold": "YOURS",
                                                        "min_threshold": "YOURS"},
                                      "instruction_key": "YOURS",
                                      "next_analysis_timedate_utc": "YOURS",
                                      "predicted_action_timedate_utc": "YOURS",
                                      "status_key": "YOURS"},
                 "fertilizer": { "done_action_timedate_utc": "YOURS",
                                 "gauge_values": { "current_value": "YOURS",
                                                   "max_threshold": "YOURS",
                                                   "min_threshold": "YOURS"},
                                 "instruction_key": "YOURS",
                                 "next_analysis_timedate_utc": "YOURS",
                                 "predicted_action_timedate_utc": "YOURS",
                                 "status_key": "YOURS"},
                 "first_sample_utc": "YOURS",
                 "global_validity_timedate_utc": "YOURS",
                 "last_processed_upload_timedate_utc": "YOURS",
                 "last_sample_upload": "YOURS",
                 "last_sample_utc": "YOURS",
                 "light": { "done_action_timedate_utc": "YOURS",
                            "gauge_values": { "current_value": "YOURS",
                                              "max_threshold": "YOURS",
                                              "min_threshold": "YOURS"},
                            "instruction_key": "YOURS",
                            "next_analysis_timedate_utc": "YOURS",
                            "predicted_action_timedate_utc": "YOURS",
                            "status_key": "YOURS"},
                 "location_identifier": "YOURS",
                 "processing_uploads": "YOURS",
                 "soil_moisture": { "done_action_timedate_utc": "YOURS",
                                    "gauge_values": { "current_value": "YOURS",
                                                      "max_threshold": "YOURS",
                                                      "min_threshold": "YOURS"},
                                    "instruction_key": "YOURS",
                                    "next_analysis_timedate_utc": "YOURS",
                                    "predicted_action_timedate_utc": "YOURS",
                                    "status_key": "YOURS"},
                 "total_sample_count": "YOURS",
                 "user_sharing": {"first_all_green": {"sharing_status": "YOURS"}}}],
 "sensors": [{"battery_level": {"battery_end_of_life_date_utc": "YOURS",
                                  "level_percent": "YOURS"},
               "current_history_index": "YOURS",
               "last_upload_datetime_utc": "YOURS",
               "processing_uploads": "YOURS",
               "sensor_serial": "YOURS",
               "total_uploaded_samples": "YOURS"}],
 "server_identifier": "YOURS",
 "user_config_version": "YOURS"
 }

HTTP Request

GET https://apiflowerpower.parrot.com/v4/gardenlocation_status

Query Parameters

No parameters.

Errors

Configuration errors

Error Code Name Error message
9000 UNKNOWN_LOCATION The requested garden location does not exist
9001 SENSOR_SERIAL_ALREADY_EXISTS Request to create a sensor with duplicate serial number
9002 SENSOR_SERIAL_DOES_NOT_EXIST Supplied sensor serial number does not exist or is not owned by me
9003 NOT_MY_SENSOR Sensor assigned to a different account - cannot update
9004 NOT_MY_LOCATION Location assigned to a different account
9005 NO_PLANT_AT_LOCATION This feature requires a plant to be assigned to the location
9008 SENSOR_FIND_ERROR The sensor does not exist or is not assigned to this location
9009 EVENT_ID_INVALID One, or more, of the event ids were invalid
9010 LOCATION_FIND_ERROR The location does not exist or is not assigned to this user
9011 UNKNOWN_DETECTOR_TYPE The supplied detector type is invalid
9012 UNSUPPORTED_HISTORY_FORMAT Invalid or unsupported history format
9014 UNSUPPORTED_RESOLUTION Supplied sample resolution is not supported
9019 STALE_DATA_UPDATE_ERROR Cannot update from supplied data as server data is newer
9020 INVALID_USER_DATA_VERSION Cannot update as the supplied user data version EXCEEDS the server version
9021 LOCATION_ALREADY_EXISTS Cannot create a location with the same location identifier
9022 UNKNOWN_ACTION Sync could not work out what to do for an item
9023 EVENT_CREATE_ERROR Attempt to create an event failed
9030 UNKNOWN_IMAGE_ACTION Action not recognized, expected c, u or d
9031 MISSING_LOCATION_IDENTIFIER Location identifier parameter missing
9032 GPS_DATA_MISSING GPS data missing - cannot suggest plants
9035 RESET_ID_INVALID Supplied id is invalid or not found
9036 RESET_ID_EXPIRED Supplied id has expired
9037 RESET_ID_ALREADY_USED Supplied id has been used
9038 GARDEN_LOCATION_NOT_ACTIVE Requested suggestions for a location that does not have sensor associated
9039 NO_LOCATION_STATUS_PRESENT Location for supplied location does not exist
9040 MISSING_PLANT_ASSIGNED_DATE If setting a plant id you MUST supply an assigned date (or removed)
9041 INVALID_OR_MISSING_FROM_DATE Expected a from date and was invalid or absent
9042 INVALID_OR_MISSING_TO_DATE Expected a to date and was invalid or absent
9043 DEVICE_TIME_MISSING Expected a mandatory datetime and was absent
9044 DEVICE_TIME_OUT_OF_RANGE Device time out of acceptable synch with server time
9045 USER_SHARING_INVALID_SET_OPTION The parameter can only be to_be_reminded, never_remind or shared
9046 USER_SHARING_INVALID_SET_OPTION_
==> FOR_CURRENT_STATE User sharing cannot be set to new state when in current state
9047 INVALID_UNKNOWN_OR_PRIVATE_LOCATION Either the identifier does not exist or is private
9048 REQUEST_DATE_SPAN_TOO_LARGE The requested date span is too large
9049 INVALID_DATE_FORMAT Could not parse the supplied date format use YYYY-MM-DD
9050 UNKNOWN_PLANT_SCIENCE_DATABASE The supplied library database identifier was not valid
9051 INVALID_GPS_DATA The supplied gps data was invalid or out of range

Common errors

Error Code Name Error message
5000 UNSUPPORTED_API The requested version of this message is not supported
5001 NOT_YET_IMPLEMENTED This feature has not yet been implemented
5003 NOT_ENOUGH_PARAMETERS Invalid number of parameters
5003 DEPRECATED_IS_ERROR This function is deprecated and cannot be called
5005 JSON_PARSE_ERROR Malformed JSON error
5006 S3_ID_MISSING S3_ID_MISSING
5007 S3_SECRET_MISSING S3_SECRET_MISSING
5008 UNSUPPORTED_LANGUAGE Unsupported language

User errors

Error Code Name Error message
8000 USER_ALREADY_EXISTS The user email already exists
8001 INVALID_EMAIL_FORMAT The supplied email is invalid
8002 INVALID_PASSWORD_FORMAT The supplied password is invalid
8003 INVALID_USER The supplied user is invalid
8004 UNKNOWN_USER_EMAIL The supplied email is not recognised
8005 MISSING_USERNAME Username is missing
8006 USERNAME_EXISTS Username is already in system
8007 USERNAME_FORMAT_INVALID Username is invalid
8008 UNKNOWN_OR_INVALID_USER User is missing