It is easy to submit new data to a Portal, simply using standard HTTP URLs. The URL can be submitted directly from the address bar of your browser (but of course this would get tedious).
We will first describe the URL syntax, and follow this with examples that demonstrate how easy it is to feed your data to a CHORDS Portal, using Python, C, a browser or the command line. These are only a few of the languages that work, and you should be able to figure out a similar method for your own particular langauge. Almost all programming languages have functions for submitting HTTP requests.
Sample URLs for submitting measurements to the Portal:
http://myportal.org/measurements/url_create?instrument_id=25&wdir=038&wspd=3.2&at=2015-08-20T19:50:28 http://myportal.org/measurements/url_create?instrument_id=1&p=981.2&key=A56F421 http://myportal.org/measurements/url_create?instrument_id=4&p=981.2&key=A56F421&at=2015-08-20T19:50:28&test
myportal.org is the hostname of your Portal. The fields after “?” are quallifiers, each separated by “&”.
Measurements for variables are specified by shortname=value pairs. You do not need to include measurements for all variables defined for the instrument, if they are not available.
|instrument_id=id||No||The Portal assigned instrument identifier.|
|at=time||Yes||Specify a timestamp to be applied to the measurements. If at is not specified, the measurement will be stamped with the time that it was received by the Portal (often quite adequate). The time format is ISO8061.|
|key=value||Yes||If the Portal has been configured to require a security key for incoming measurements, it is specified with the key qualifier. Keys are case sensitive.|
|test||Yes||Add the test qualifier to signify that the measurements are to be marked as test values. Test measurements may be easily deleted using the Portal interface.|
Data can be submitted to a portal just by typing the URL into the address bar of a browser. It's unlikely that you would use this method for any serious data collection!
The wget and curl commands, available in Linux and OSX, can accomplish the same thing from a console.
This example uses the libCurl library in a C program to send a measurement URL to a portal.