MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "40": {
                "pageid": 40,
                "ns": 0,
                "title": "API",
                "revisions": [
                    {
                        "user": "KKoPV",
                        "timestamp": "2015-02-17T13:04:51Z",
                        "comment": "",
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "[[Category:API]]{{TOCright}}\n<blockquote>An application programming interface (API) is a protocol intended to be used as an interface by software components to communicate with each other.\n<cite>[[Wikipedia:API]]</cite></blockquote>\n\nThe API is implemented as a [[Wikipedia:REST|RESTful API]], so it uses HTTP requests to store and read data. Thus, REST uses HTTP for all four CRUD (Create / Read / Update / Delete) operations.\n\nYou can query the actual API version with  <tt><nowiki>http://your.domain.here/api/version</nowiki></tt><br />\nMake sure you request latest API version with <tt><nowiki>http://your.domain.here/api/latest/...</nowiki></tt> (from PVLng '''2.12.0''' and PVLng-scripts '''1.6.0''' onward)\n\n(see [[:Category:API|API r*]] pages for supported API versions)\n\nPVLng supports these request types:\n{| class=\"wikitable\"\n|-\n! Request method !! Action\n|-\n| <tt>PUT</tt> || '''Create''' data set\n|-\n| <tt>GET</tt> || '''Read''' data set(s)\n|-\n| <tt>POST</tt> || '''Update''' data set\n|-\n| <tt>DELETE</tt> || '''Delete''' data set\n|}\n\n== Data storage ==\n\nFor data storage we have two possibilities:\n* Web frontend for the master data, like channels and their relationships\n* HTTP REST API for the operational channel data with HTTP PUT requests like [[Data storage example|this example]]\n\nThe storage API accepts only one parameter <tt>data</tt> and routes it to the requested channel.\n\nBy default (load live data) system date and time will be used.\n\nThe model behind the channel represents the interface to the database.\n\n== Data readout ==\n\n''This section describes only the readout of measuring data via API, see the detailed [[API help]] for more supported actions.''\n\nThe data readout from the system must be done with HTTP GET requests.\n\nThe readout API analyzes the requests, identifies the channel and returns the extracted data.\n\nThe model behind the channel provides a defined interface to query data.\n\n=== Requested format ===\n\nThe returned content type is detected by the requested file extension\n\n{| class=\"wikitable\"\n|-\n! Extension !! Format !! Content type\n|-\n| <tt>.json</tt> || JSON (default, if no extension is set) || <tt>application/json</tt>\n|-\n| <tt>.csv</tt> || Semicolon separated values || <tt>application/csv</tt>\n|-\n| <tt>.tsv</tt> || TAB separated values || <tt>application/tsv</tt>\n|-\n| <tt>.txt</tt> || Space separated values<br />(proposed for single attribute requests) || <tt>text/plain</tt>\n|}\n\n=== Parameters ===\n\nAll parameters are optional.\n\n{| class=\"wikitable\"\n|-\n! Parameter name !! Description !! Format !! default !! Examples\n|-\n| <tt>start</tt> || Start timestamp for readout || string || <tt>00:00</tt> ||\n* <tt>YYYY-mm-dd HH:ii:ss\n* seconds since 1970\n* [http://php.net/manual/datetime.formats.relative.php relative] from now\n* sunrise<ref name=\"daylight\">needs the <tt>location</tt> defined in in <tt>config/config.php</tt></ref></tt>\n|-\n| <tt>end</tt> || End timestamp for readout || string || <tt>24:00</tt> ||\n* <tt>YYYY-mm-dd HH:ii:ss\n* seconds since 1970\n* [http://php.net/manual/datetime.formats.relative.php relative] from now\n* sunset<ref name=\"daylight\">needs the <tt>location</tt> defined in in <tt>config/config.php</tt></ref></tt>\n|-\n| <tt>period</tt> || Example  || string || <tt>&lt;empty&gt;</tt> ||\n* <tt>[1-9][0-9]*minutes\n* [1-9][0-9]*hours\n* [1-9][0-9]*days\n* [1-9][0-9]*weeks\n* [1-9][0-9]*month\n* [1-9][0-9]*quarters\n* [1-9][0-9]*years\n* last<ref>returns the last reading for selected start-end range, can be empty, if no data in range, also relevant for meter channels</ref>\n* readlast<ref>returns the last reading, ignores start-end range</ref>\n* all<ref>returns '''all''' readings, ignores start-end range, useful for full backup</ref></tt>\n|-\n| <tt>attributes</tt> || Return channel attributes as 1<sup>st</sup> data set || bool<ref name=\"bool\">All of <tt>(1|x|yes|on|true)</tt> are interpreted case-insensitive as TRUE.</ref> || <tt>0</tt> || <tt>yes</tt>\n|-\n| <tt>full</tt> || Return all<ref>datetime, timestamp, data, min, max, count, timediff, consumption</ref> data, not only timestamp and value || bool<ref name=\"bool\" /> || <tt>0</tt> || <tt>X</tt>\n|-\n| <tt>short</tt> || JSON: Return data as numeric indexed array,<br />not as object with named keys || bool<ref name=\"bool\" /> || <tt>0</tt> || <tt>On</tt>\n|}\n\n<references />\n\n=== Result ===\n\nIf parameter <tt>attributes=1</tt> is set, the 1<sup>st</sup> data set will contain the channel attributes and further rows the following fields. This is required e.g. in Web frontends [[charts module]] AJAX calls which need the channel attributes for drawing and so '''only one''' call is required to fetch attributes '''and''' data.\nData are not rounded at all, they are delivered as stored or calculated.\n\nBy default, only the '''timestamp''' and '''data''' values will be returned. If you set the request parameter <tt>full=1</tt>, all the following data are returned.\n\n{| class=\"wikitable\"\n|-\n! Field !! Description\n|-\n| <tt>datetime</tt> || A readable timestamp; mostly used for debugging\n|-\n| <tt>timestamp</tt> || UTC Timestamp, good for direct use in graphing\n|-\n| <tt>data</tt> || Reading value for this timestamp\n|-\n| <tt>min</tt> || Minimal value of consolidated data\n|-\n| <tt>max</tt> || Maximal value of consolidated data\n|-\n| <tt>count</tt> || Count of consolidated data sets for returned row\n|-\n| <tt>timediff</tt> || Time range of the consolidation in seconds\n|-\n| <tt>consumption</tt> || For meter channels the difference during time period (last datas et to this data set)\n|}\n\n== Return codes ==\n\nThe status code will be doubled into the response header and the response body.\nThis offers the possibility to analyze either the header or the body to check for success or errors.\nFor every request the response body will contain further information, especially in case of an error.\nThe following subset of HTTP status codes<ref>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html</ref> are used by the API.\n\n=== 200 - OK ===\n\nThe request has succeeded\n* Read of data was successful\n* Data was error free, but not saved\n** Insert data within 5 seconds interval will be ignored (adjustable in database table <tt>pvlng_config -> DoubleRead</tt>)\n** Not changed Switcher states will be ignored\n\n=== 201 - Created ===\n\nThe request has been fulfilled and resulted in a new resource being created\n* Data was successful saved\n* On batch loads the response body contains the count of inserted data sets.\n\n=== 204 - No Response ===\n\nThe server has fulfilled the request but does not need to return an entity-body\n* Response for a <tt>DELETE</tt> request\n\n=== 400 - Bad Request ===\n\nThe request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.\n* There was mostly a problem during data readout\n* See response body for details\n\n=== 401 - Unauthorized ===\n\nThe request requires user authentication\n* Missing or wrong API key for <tt>PUT</tt> requests\n* Missing or wrong API key for <tt>GET</tt> requests for '''private''' channels, they are only accessible with [[Security system#API key|API key]].\n\n=== 405 - Method Not Allowed ===\n\nThe method specified in the Request-Line is not allowed for the resource identified by the Request-URI\n* Only <tt>PUT / GET / POST / DELETE</tt> are allowed\n\n=== 500 - Internal Server Error ===\n\nThe server encountered an unexpected condition which prevented it from fulfilling the request.\n* See response body for details\n\n<references/>"
                    }
                ]
            },
            "1": {
                "pageid": 1,
                "ns": 0,
                "title": "Main Page",
                "revisions": [
                    {
                        "user": "KKoPV",
                        "timestamp": "2016-04-03T14:08:21Z",
                        "comment": "/* Supported systems */",
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "{{TOCright}}{{DISPLAYTITLE:<span style=\"position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);\">{{FULLPAGENAME}}</span>}}\n<p style=\"color:#404040;font-size:200%;font-weight:bold;text-shadow: 0.1em 0.1em 0.1em #B0B0B0;\">PVLng - PhotoVoltaic Logger new generation</p>\n\n<p style=\"width:75%;color:#404040;font-size:140%;font-weight:bold;text-shadow: 0.1em 0.1em 0.1em #B0B0B0;\">A logging and data warehouse system for measuring data of sensors and photovoltaic plants.</p>\n\nThe system acts basely as a data warehouse.\n\n<blockquote>In computing, a data warehouse (DW, DWH), or an enterprise data warehouse (EDW), is a database used for reporting and data analysis. Integrating data from one or more disparate sources creates a central repository of data, a data warehouse (DW). Data warehouses store current and historical data and are used for creating trending reports for senior management reporting such as annual and quarterly comparisons.\n<cite>[[Wikipedia:Data warehouse]]</cite></blockquote>\n\nAll data will be stored in an very simple and efficient internal structure ([[Database_structure#Measuring_data_storage|readings]]), optimized for data readout of any kind with a well defined [[API]] interface.\n\n== Get started ==\n\nStart with the [[introduction]], [[design and concept]] or [[Quick start]], check [[API]] description or browse [[Special:AllPages|all pages]].\n\n== Supported systems ==\n\n{|\n|-\n! Data sources !! !! Data targets\n|-\n|\n* [http://www.fronius.com/cps/rde/xchg/fronius_international/hs.xsl/83_ENG_HTML.htm Fronius] inverters with ComCard\n* [http://kostal-solar-electric.com/ Kostal] Piko inverters\n* [http://kaco-newenergy.com/products/solar-pv-inverters Kaco] inverters (RS485 yet)\n* [http://owfs.org OWFS], all sensors\n* S0 signals\n* Energy meters with D0 according to [http://en.wikipedia.org/wiki/IEC_62056#IEC_62056-21 IEC 62056-21]\n* [http://sma.com/ SMA] inverters and Sensorbox via Webbox\n* [http://www.wunderground.com/ Weather underground]\n* (Open weather map, but Weather undergound is suggested :-)\n|| ||\n* Alerts as mail or via Twitter\n* Mail for statistics\n* [http://pvoutput.com PVOutput]\n* [http://pv-log.com PV-Log]\n* [http://Sonnenertrag.eu Sonnenertrag.eu]\n* [https://thingspeek.com ThingSpeek]\n* [http://twitter.com Twitter]\n* [http://xively.com Xively]\n|}\n\nSome of them are described on the [[:Category:Scripts|Scripts]] page.\n\n== Get it ==\n\nThe source of the logger system is hosted on [https://github.com/KKoPV GitHub]\n\nThe system consists of '''2''' independend repositories\n* [[:Category:Web frontend|Web frontend]] and [[API]] in {{PVLngRepo}}\n* [[:Category:Scripts|Data acquisition scripts]] in {{PVLngScriptsRepo}}\n\nPlease check before [[installation]] the hard- and software requirements.\n\n A [http://demo.pvlng.com/ demo installation] is available to get a feeling.\n\n== Get support ==\n<div style=\"float:right;text-align:right\">{{#widget:Twitter Follow Button|user=PVLng_com}}</div>\n* [https://github.com/KKoPV/PVLng/issues PVLng core Issue tracker]\n* [https://github.com/KKoPV/PVLng-scripts/issues PVLng scripts Issue tracker]\n* If you have problems with the frontend, it would be nice if you [http://supportdetails.com/?recipient=admin@pvlng.com send me] some details about it.\n\n== Help needed ==\n\n* Settings for other distributions than Debian\n* Settings for other web servers than Apache and Nginx\n\n== Contribute ==\n\n* For an account to edit articles with [mailto:admin@pvlng.com contact me].\n* [http://pvlng.com/Special:UserLogin Login] and write articles.\n* All code contributions and bug reports are much appreciated.\n** The project is managed with the Git Flow branching model<ref>http://nvie.com/posts/a-successful-git-branching-model/</ref> and tools<ref>https://github.com/nvie/gitflow</ref>, so all pull requests '''must always''' target the <tt>'''develop'''</tt> branch!\n** Please use soft tabs (four spaces) instead of hard tabs\n** Include commenting where appropriate and add a descriptive pull request message\n* [[File:Donate.gif]] [https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40knutkohl%2ede&item_name=Donation+for+PVLng with PayPal]\n\n== Contributions ==\n[[Contributions|List]] about used software in PVLng\n\n== License ==\n\n The MIT License (MIT)\n \n Copyright &copy; 2012-2015 Knut Kohl <github@knutkohl.de>\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n \n http://opensource.org/licenses/MIT\n\n----\n<references />"
                    }
                ]
            }
        }
    }
}