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=[INST_ID]&wdir=038&wspd=3.2&at=2015-08-20T19:50:28 http://myportal.org/measurements/url_create?instrument_id=[INST_ID]&p=981.2&email=[USER_EMAIL]&api_key=[API_KEY] http://myportal.org/measurements/url_create?instrument_id=[INST_ID]&p=981.2&email=[USER_EMAIL]&api_key=[API_KEY]&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.|
|email=[USER_EMAIL]||Yes||If the Portal has been configured to require a security key for incoming measurements, the user email, email qualifier is needed.|
|api_key=[API_KEY]||Yes||If the Portal has been configured to require a security key for incoming measurements, it is specified with the api_key qualifier. Keys are case sensitive and specific for a given user with the measurements permission enabled.|
|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.