Logging API access

Log entry to test Logging API

Log entry to test Logging API (see the log entry here)

You can log measurements / entries on firtl.com’s log using an HTTP POST request.

Send the following data in the POST request:

Field “apikey” is the API Key on which you are posting the data. API Keys can be created in your user page.
Field “name” is the name of the subject for which you are making a log entry. Example “subject=WaterMeter”.
Field “value” is the value – usually numeric – of the log entry. The ‘value’ of a subject whose units are ‘event’ is ‘1’. Example “value=123.45”
Field “unit” is the unit of the value. Example “unit=kWh”.
Field “text” is any accompanying text you wish to supply. Example “text=Just a test”.
Field “tags” allows you to specify a comma-separated list of tags for the log entry. Example “tags=tag1,tag2”.
Field “attach” is for attaching associated files. It may be specified any number of times. The POSTed files will be attached to the log entry.

The fields apikey, name, value, unit are mandatory.

An example API Key “Volume Measurement Test” is:

i5sraff1qUl6qP4EdmvnBYy9moNxMDutQ1mdV9ut1f1RPjLTz8uJpjrt2RQni5MAQ6mVIiq_E5B4Yh-d

The API key is owned by the user who created it. In this case the owner is ‘Test’, who will also be the owner of any log entries created using this API key. Send a POST request like:

curl http://www.firtl.com/log/api/log.json -F "apikey=i5sraff1qUl6qP4EdmvnBYy9moNxMDutQ1mdV9ut1f1RPjLTz8uJpjrt2RQni5MAQ6mVIiq_E5B4Yh-d" -F "name=TestVolumeMeasurement" -F "value=250" -F "unit=millilitre" -F "text=A measuring cup found at (test anchors) <a href=\"http://wikimedia.org/\">Wikimedia.org</a>" -F "attach=@Simple_Measuring_Cup.jpg"

The reply includes the identification number of the new log entry if successful. A ‘redirect’ version of the API method should redirect your browser to the newly created log entry if the form below submits correctly:

One thought on “Logging API access

  1. Pingback: Read Gas / Water / Electricity Meter with webcam | Firtl.com

Leave a Reply

Your email address will not be published. Required fields are marked *