Data In

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.

URL Syntax

Sample URLs for submitting measurements to the Portal: 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.

Qualifier Optional Meaning
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.

Programming Examples


# Put a collection of measurements into the portal
import requests
url = ''
response = requests.get(url=url)
print response
<Response [200]>

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!

CHORDS Portal Cartoon

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.

#include <stdio.h>
#include <curl/curl.h>
int main(void)
  CURL *curl;
  CURLcode res;
  curl = curl_easy_init();
  if(curl) {
    char* url = "";
    curl_easy_setopt(curl, CURLOPT_URL, url);
    /* is redirected, so we tell libcurl to follow redirection */ 
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    /* Perform the request, res will get the return code */ 
    res = curl_easy_perform(curl);
    /* Check for errors */ 
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
    /* always cleanup */ 
  return 0;