API help
From PhotoVoltaic Logger new generation
Here you have all the possible requests, which the API supports at the moment.
r4
{
"/api/r4/attributes/:guid(/:attribute)": {
"methods": "GET",
"since": "r2",
"description": "Fetch all channel attributes or specific channel attribute",
"apikey": 0,
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}",
"attribute": "\\w+"
}
},
"/api/r4/batch/:guid": {
"methods": "PUT",
"since": "r2",
"description": "Save multiple reading values",
"apikey": 1,
"payload": {
"<timestamp>,<value>;...": "Semicolon separated timestamp and value data sets",
"<date time>,<value>;...": "Semicolon separated date time and value data sets",
"<date>,<time>,<value>;...": "Semicolon separated date, time and value data sets"
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/channel/:guid": {
"methods": "GET",
"since": "r3",
"description": "Fetch single channel attribute",
"apikey": 0,
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/channel/:guid/:attribute": {
"methods": "GET",
"since": "r3",
"description": "Fetch all channel attributes or specific channel attribute",
"apikey": 0,
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}",
"attribute": "\\w+"
}
},
"/api/r4/channels": {
"methods": "GET",
"since": "r3",
"description": "Fetch all channels",
"apikey": 0
},
"/api/r4/csv/:guid": {
"methods": "PUT",
"since": "r2",
"description": "Save multiple reading values from CSV file",
"apikey": 1,
"payload": {
"<timestamp>;<value>": "Semicolon separated timestamp and value data rows",
"<date time>;<value>": "Semicolon separated date time and value data rows",
"<date>;<time>;<value>": "Semicolon separated date, time and value data rows"
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/data/:guid": {
"methods": "PUT",
"since": "r2",
"description": "Save a reading value",
"apikey": 1,
"payload": "{\"<data>\":\"<value>\"}",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/data/:guid(/:p1(/:p2))": {
"methods": "GET",
"since": "r2",
"description": "Read reading values",
"apikey": 0,
"parameters": {
"start": {
"description": "Start timestamp for readout, default today 00:00",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php",
"sunrise - needs location in config/config.php"
]
},
"end": {
"description": "End timestamp for readout, default today midnight",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php",
"sunset - needs location in config/config.php"
]
},
"period": {
"description": "Aggregation period, default none",
"value": [
"[0-9.]+minutes",
"[0-9.]+hours",
"[0-9.]+days",
"[0-9.]+weeks",
"[0-9.]+month",
"[0-9.]+quarters",
"[0-9.]+years",
"last",
"readlast",
"all"
]
},
"attributes": {
"description": "Return channel attributes as 1st line",
"value": [
1,
"true"
]
},
"full": {
"description": "Return all data, not only timestamp and value",
"value": [
1,
"true"
]
},
"short": {
"description": "Return data as array, not object",
"value": [
1,
"true"
]
}
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/data/:guid/:timestamp": {
"methods": "DELETE",
"since": "r2",
"description": "Delete a reading value",
"apikey": 1,
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"/api/r4/daylight/(/:offset)": {
"methods": "GET",
"since": "r3",
"description": "Check for daylight for configured location, accept additional minutes before/after",
"apikey": 0,
"conditions": {
"offset": "\\d+"
}
},
"/api/r4/daylight/:latitude/:longitude(/:offset)": {
"methods": "GET",
"since": "r3",
"description": "Check for daylight, accept additional minutes before/after",
"apikey": 0,
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"offset": "\\d+"
}
},
"/api/r4/hash": {
"methods": "GET, POST",
"since": "r3",
"description": "Create MD5 and SHA1 hashes and a slug for the given text",
"apikey": 0,
"parameters": {
"text": {
"description": "Text to make hashes for"
}
}
},
"/api/r4/help": {
"methods": "ANY",
"since": "r1",
"description": "This help, overview of valid calls",
"apikey": 0
},
"/api/r4/json/:path+": {
"methods": "POST",
"since": "r1",
"description": "Extract a section/value from given JSON data sended in request body e.g. from a file",
"apikey": 0
},
"/api/r4/log": {
"methods": "PUT",
"since": "r2",
"description": "Store new log entry, scope defaults to 'API rr4'",
"apikey": 1,
"payload": "{\"scope\":\"...\", \"message\":\"...\"}"
},
"/api/r4/log/:id": {
"methods": "DELETE",
"since": "r2",
"description": "Delete a log entry",
"apikey": 1,
"conditions": {
"id": "\\d+"
}
},
"/api/r4/log/all(/:page(/:count))": {
"methods": "GET",
"since": "r2",
"description": "Read all log entries, paginated for :page, :count entries",
"apikey": 1
},
"/api/r4/ping": {
"methods": "GET",
"since": "r4",
"description": "For new relic pinger",
"apikey": 0
},
"/api/r4/status": {
"methods": "GET",
"since": "r2",
"description": "System status",
"apikey": 1
},
"/api/r4/sunrise/(/:date)": {
"methods": "GET",
"since": "r3",
"description": "Get sunrise of day, using configured loaction",
"apikey": 0,
"conditions": {
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"/api/r4/sunrise/:latitude/:longitude(/:date)": {
"methods": "GET",
"since": "r3",
"description": "Get sunrise for location and day",
"apikey": 0,
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"/api/r4/sunset/(/:date)": {
"methods": "GET",
"since": "r3",
"description": "Get sunset of day, using configured loaction",
"apikey": 0,
"conditions": {
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"/api/r4/sunset/:latitude/:longitude(/:date)": {
"methods": "GET",
"since": "r3",
"description": "Get sunset of day",
"apikey": 0,
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"/api/r4/tariff": {
"methods": "GET",
"since": "r4",
"description": "Extract all tariffs",
"apikey": 1
},
"/api/r4/tariff/:id": {
"methods": "GET",
"since": "r4",
"description": "Extract a tariff",
"apikey": 1,
"conditions": {
"id": "\\d+"
}
},
"/api/r4/tariff/:id/:date": {
"methods": "GET",
"since": "r4",
"description": "Extract tariff for a day",
"apikey": 1,
"conditions": {
"id": "\\d+",
"date": "[0-9]{4}-[0-9]{2}-[0-9]{2}"
}
},
"/api/r4/tariff/:id/time/:date(/:to)": {
"methods": "GET",
"since": "r4",
"description": "Extract tariff for a day",
"apikey": 1,
"conditions": {
"id": "\\d+",
"date": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
"to": "[0-9]{4}-[0-9]{2}-[0-9]{2}"
}
},
"/api/r4/translation": {
"methods": "GET",
"since": "r3",
"description": "Extract english texts for translation",
"apikey": 0
},
"/api/r4/tree/:id": {
"methods": "DELETE",
"since": "r4",
"description": "Delete channel from channel tree",
"apikey": 1,
"conditions": {
"id": "\\d+"
}
},
"/api/r4/view": {
"methods": "PUT",
"since": "r3",
"description": "Create chart view data, return slug",
"apikey": 0
},
"/api/r4/view/:slug": {
"methods": "DELETE",
"since": "r3",
"description": "Detele chart view data by slug",
"apikey": 1,
"conditions": {
"slug": "[\\w\\d-]+"
}
},
"/api/r4/views(/:language)": {
"methods": "GET",
"since": "r3",
"description": "Fetch all charts",
"apikey": 0
}
}
r3
"ANY /api/r3/help": {
"since": "v1",
"description": "This help, overview of valid calls"
},
"GET /api/r3/:guid": {
"since": "v2",
"description": "Fetch attributes",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"GET /api/r3/:guid/:attribute": {
"since": "v2",
"description": "Fetch single channel attribute",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}",
"attribute": "\\w+"
}
},
"GET /api/r3/attributes/:guid(/:attribute)": {
"since": "v2",
"description": "Fetch all channel attributes or specific channel attribute",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}",
"attribute": "\\w+"
}
},
"GET /api/r3/channels": {
"since": "v3",
"description": "Fetch attributes"
},
"GET /api/r3/channel/:guid": {
"since": "v3",
"description": "Fetch single channel attribute",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"GET /api/r3/channel/:guid/:attribute": {
"since": "v3",
"description": "Fetch all channel attributes or specific channel attribute",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}",
"attribute": "\\w+"
}
},
"PUT /api/r3/data/:guid": {
"since": "v2",
"description": "Save a reading value",
"payload": "{\"<data>\":\"<value>\"}",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"GET /api/r3/data/:guid(/:p1(/:p2))": {
"since": "v2",
"description": "Read reading values",
"parameters": {
"start": {
"description": "Start timestamp for readout, default today 00:00",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php",
"sunrise - needs location in config/config.php"
]
},
"end": {
"description": "End timestamp for readout, default today midnight",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php",
"sunset - needs location in config/config.php"
]
},
"period": {
"description": "Aggregation period, default none",
"value": [
"[0-9.]+minutes",
"[0-9.]+hours",
"[0-9.]+days",
"[0-9.]+weeks",
"[0-9.]+month",
"[0-9.]+quarters",
"[0-9.]+years",
"last",
"readlast",
"all"
]
},
"attributes": {
"description": "Return channel attributes as 1st line",
"value": [
1,
"true"
]
},
"full": {
"description": "Return all data, not only timestamp and value",
"value": [
1,
"true"
]
},
"short": {
"description": "Return data as array, not object",
"value": [
1,
"true"
]
}
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"DELETE /api/r3/data/:guid/:timestamp": {
"since": "v2",
"description": "Delete a reading value",
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"PUT /api/r3/batch/:guid": {
"since": "v2",
"description": "Save multiple reading values",
"payload": {
"<timestamp>,<value>;...": "Semicolon separated timestamp and value data sets",
"<date time>,<value>;...": "Semicolon separated date time and value data sets",
"<date>,<time>,<value>;...": "Semicolon separated date, time and value data sets"
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"PUT /api/r3/csv/:guid": {
"since": "v2",
"description": "Save multiple reading values",
"payload": {
"<timestamp>;<value>": "Semicolon separated timestamp and value data rows",
"<date time>;<value>": "Semicolon separated date time and value data rows",
"<date>;<time>;<value>": "Semicolon separated date, time and value data rows"
},
"conditions": {
"guid": "(\\w{4}-){7}\\w{4}"
}
},
"PUT /api/r3/log": {
"since": "v2",
"description": "Store new log entry, scope defaults to 'API r2'",
"payload": "{\"scope\":\"...\", \"message\":\"...\"}"
},
"GET /api/r3/log/:id": {
"since": "v2",
"description": "Read a log entry",
"conditions": {
"id": "\\d+"
}
},
"GET /api/r3/log/all(/:page(/:count))": {
"since": "v2",
"description": "Read all log entries, paginated for :page, :count entries"
},
"POST /api/r3/log/:id": {
"since": "v2",
"description": "Update a log entry",
"payload": "{\"scope\":\"...\", \"message\":\"...\"}",
"conditions": {
"id": "\\d+"
}
},
"DELETE /api/r3/log/:id": {
"since": "v2",
"description": "Delete a log entry",
"conditions": {
"id": "\\d+"
}
},
"GET /api/r3/sunrise/(/:date)": {
"since": "v3",
"description": "Get sunrise of day, using configured loaction",
"conditions": {
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"GET /api/r3/sunrise/:latitude/:longitude(/:date)": {
"since": "v3",
"description": "Get sunrise for location and day",
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"GET /api/r3/sunset/(/:date)": {
"since": "v3",
"description": "Get sunset of day, using configured loaction",
"conditions": {
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"GET /api/r3/sunset/:latitude/:longitude(/:date)": {
"since": "v3",
"description": "Get sunset of day",
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"date": "\\d{4}-\\d{2}-\\d{2}"
}
},
"GET /api/r3/daylight/(/:offset)": {
"since": "v3",
"description": "Check for daylight for configured location, accept additional minutes before/after",
"conditions": {
"offset": "\\d+"
}
},
"GET /api/r3/daylight/:latitude/:longitude(/:offset)": {
"since": "v3",
"description": "Check for daylight, accept additional minutes before/after",
"conditions": {
"latitude": "[\\d.-]+",
"longitude": "[\\d.-]+",
"offset": "\\d+"
}
},
"GET /api/r3/json/:path+": {
"description": "Extract a section/value from given JSON data from query string",
"payload": "...json/path/to/node/?json=<JSON data>"
},
"POST /api/r3/json/:path+": {
"description": "Extract a section/value from given JSON data sended in request body e.g. from a file"
},
"GET /api/r3/views": {
"since": "v3",
"description": "Fetch chart view data via slug"
},
"PUT /api/r3/view": {
"since": "v3",
"description": "Create chart view data, return slug"
},
"GET /api/r3/view/:slug": {
"since": "v3",
"description": "Fetch chart view data via slug",
"conditions": {
"slug": "[@\\w\\d-]+"
}
},
"POST /api/r3/view/:slug": {
"since": "v3",
"description": "Update chart view data via slug",
"conditions": {
"slug": "[@\\w\\d-]+"
}
},
"DELETE /api/r3/view/:slug": {
"since": "v3",
"description": "Detele chart view data by slug",
"conditions": {
"slug": "[@\\w\\d-]+"
}
},
"GET|POST /api/r3/hash": {
"since": "v3",
"description": "Create MD5 and SHA1 hashes and a slug for the given text",
"parameters": {
"text": {
"description": "Text to make hashes for"
}
}
},
"GET /api/r3/status": {
"since": "v2",
"description": "System status"
},
"GET /api/r3/translation": {
"since": "v3",
"description": "Extract english texts for translation"
}
r2
{
"ANY /api/r2/help": {
"since": "v1",
"description": "This help, overview of valid calls"
},
"GET /api/r2/:guid": {
"since": "v2",
"description": "Fetch attributes"
},
"GET /api/r2/:guid/:attribute": {
"since": "v2",
"description": "Fetch single channel attribute"
},
"GET /api/r2/attributes/:guid(/:attribute)": {
"since": "v2",
"description": "Fetch all channel attributes or specific channel attribute"
},
"PUT /api/r2/data/:guid": {
"since": "v2",
"description": "Save a reading value",
"payload": "{\"data\":\"<value>\"}"
},
"DELETE /api/r2/data/:guid/:timestamp": {
"since": "v2",
"description": "Delete a reading value"
},
"GET /api/r2/data/:guid(/:p1(/:p2))": {
"since": "v2",
"description": "Read reading values",
"parameters": {
"start": {
"description": "Start timestamp for readout, default today 00:00",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php"
]
},
"end": {
"description": "End timestamp for readout, default today midnight",
"value": [
"YYYY-mm-dd HH:ii:ss",
"seconds since 1970",
"relative from now, see http://php.net/manual/en/datetime.formats.relative.php"
]
},
"period": {
"description": "Aggregation period, default none",
"value": [
"[0-9.]+minutes",
"[0-9.]+hours",
"[0-9.]+days",
"[0-9.]+weeks",
"[0-9.]+month",
"[0-9.]+quarters",
"[0-9.]+years",
"last",
"readlast",
"all"
]
},
"attributes": {
"description": "Return channel attributes as 1st line",
"value": [
1,
"true"
]
},
"full": {
"description": "Return all data, not only timestamp and value",
"value": [
1,
"true"
]
},
"short": {
"description": "Return data as array, not object",
"value": [
1,
"true"
]
}
}
},
"PUT /api/r2/csv/:guid": {
"since": "v2",
"description": "Save multiple reading values",
"payload": {
"<timestamp>;<value>": "Semicolon separated timestamp and value data rows",
"<date time>;<value>": "Semicolon separated date time and value data rows",
"<date>;<time>;<value>": "Semicolon separated date, time and value data rows"
}
},
"PUT /api/r2/batch/:guid": {
"since": "v2",
"description": "Save multiple reading values",
"payload": {
"<timestamp>,<value>;...": "Semicolon separated timestamp and value data sets",
"<date time>,<value>;...": "Semicolon separated date time and value data sets",
"<date>,<time>,<value>;...": "Semicolon separated date, time and value data sets"
}
},
"PUT /api/r2/log": {
"since": "v2",
"description": "Store new log entry, scope defaults to 'API r2'",
"payload": "{\"scope\":\"...\", \"message\":\"...\"}"
},
"GET /api/r2/log/:id": {
"since": "v2",
"description": "Read a log entry"
},
"GET /api/r2/log/all(/:page(/:count))": {
"since": "v2",
"description": "Read all log entries, paginated for :page, :count entries"
},
"POST /api/r2/log/:id": {
"since": "v2",
"description": "Update a log entry",
"payload": "{\"scope\":\"...\", \"message\":\"...\"}"
},
"DELETE /api/r2/log/:id": {
"since": "v2",
"description": "Delete a log entry"
},
"GET /api/r2/status": {
"since": "v2",
"description": "System status"
}
}