The API endpoint is located at:
https://metrics.watersuite.com/api/20160218/
The API expects and responds with JSON payloads.
A reading (datapoint) can be submitted with a JSON payload that looks like:
{
"username": "username",
"password": "password",
"action" : "add_data_points"
"datapoints" : {
"name" : "com.example.premise.1.location.1.sensor.temperature",
"timestamp" : 1455820130000,
"value" : 13.2,
"tags" : {
"units" : "Degrees_C",
}
}
}
The server will respond with a JSON payload that either indicates successful submission:
{"status": "ok"}
or error with a description of the problem:
{"message": "Invalid credentials", "status": "error"}
Expected inputs are described below:
username: String. The user name provided to you for using the API.
password: String. The password provided to you for using the API.
action: String. Action to take. Use "add_data_points" for submitting metrics.
name: String. Metric name. Metric name should start with the reverse domain
that your user is allowed to submit metrics for. You should design the
rest of the metric name considering how you would like to track metrics
from different locations, metrics, test vs. production, etc.
timestamp: Number. This is epoch time (Time since 1/1/1970) in milliseconds. Nearly
all programming languages provide a way to compute this in seconds. You
need to convert to milliseconds when submitting.
value: Number. The numeric reading (typically from a sensor).
units: String. The units associated with the metric.
NOTE: Only alphanumeric, period, slash, dash and underscore characters are allowed in string values.
The JSON schema for the "add_data_points" action is provided below:
{
"type": "object",
"properties": {
"username": {"type" : "string"},
"password": {"type" : "string"},
"action": {"type" : "string"},
"datapoints" : {
"type": "object",
"properties": {
"name": {"type" : "string"},
"timestamp": {"type" : "number"},
"value": {"type" : "number"},
"tags" : {
"type": "object",
"properties": {
"units": {"type" : "string"},
},
"required": ["units"]
}
},
"required": ["name","timestamp","value","tags"]
}
},
"required": ["username","password","action","datapoints"]
}
Contact email for questions regarding this API:
aergul@procstep.com