Create time series for variables of a site

Presentation

Description Authorization Method Query
This query allows to create data time series for one or several variables of a site. To simplify and limit the impact of such a shipment on the bandwidth, we chose to write the series Temporal data within several TSV files and to send all these files into a ZIP archive.This request only allows a ZIP archive to be sent to the server. Data storage is done asynchronously. A data processing job is started which will indicate whether the data has been saved in the database or not If you want to know the status of the job, you will have to run the query Described in the section Retrieve the status of the job for processing time series. Required by Basic HTTP (username and password) POST /v1/users/:userID/sites/:siteID/variables/series

URL parameter

Parameter Type Description
:userID String Unique identifier of the user If you do not know your username, you can use the keyword "current" instead.
:siteID String Unique identifier of the site.

Query parameter

Required

Parameter Type Description
zip File Archive in ZIP format containing all TSV files containing the time series of data A file corresponds to the data of a variable The format of the TSV files is described below.
Format

Each time series must be stored in a different TSV file where each entity must be separated by tabs, so there will be a TSV file by Variable, which will then be gathered in a ZIP archive to be compressed The ZIP archive will be named SITE_ID-series.zip where SITE_ID is the site identifier Each TSV file inside the archive will be named VARIABLE_ID.YYMMDDHHmmss.csv where VARIABLE_ID is the identifier of the variable , And YYMMDDHHmmss is the creation date of the file in YYMMDDHHmmss format. For example, if we create the file on May 20, 2014 at 18:33:24 for variable plug_3, the file name will be plug_3.140520183324.csv. Let's continue our example and that our site is called TEST_PARIS, we will generate a ZIP archive which will have as name TEST_PARIS-series.zip and will contain a single file that will be called plug_3.140520183324.csv.

Here is the format of a time series of a variable (replace VARIABLE_ID with the identifier of your variable, SITE_ID with the identifier of your site and the & quot; timestamps & quot; and & quot; values ​​& quot; Data) :

            FORMAT_VERSION  1
            CREATION_DATE   2014-05-15T16:04:34Z
            ID_SITE SITE_ID
            FEEDBACK_TO me@worldcompany.com
            VARNAME VARIABLE_ID

            2013-10-24T00:00:00Z    11894
            2013-10-24T06:00:00Z    11894
            2013-10-24T12:00:00Z    11894
            2013-10-24T18:00:00Z    11895
            
FORMAT_VERSION Version of the file format used. Currently, we are using version 1.
CREATION_DATE Creation date of the file.
ID_SITE Your site's identifier,
FEEDBACK_TO E-mail address of the person in charge of the site who will be notified of the creation of the data,
VARNAME Unique identifier of the variable,
timestamp Each following line must contain a valid UTC date in ISO8601 format
value Each following line must contain a value that is consistent with the metadata definition of the variable.

Optional

None.

Successful message

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series' -u cstb_test:cstb2014 -F zip=@test_site-series.zip

            201 CREATED

            {
                "message": "Data transfered with success.",
                "jobID": "53"
            }
            

Details

Parameter Type Description
jobID String Job number created on the server side This job number must be used in the job retrieval request to see whether the time series contained in the ZIP archive are saved or not.

Error message & quot; Missing ZIP archive "

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series' -u cstb_test:cstb2014

            400 BAD REQUEST

            {
                "error": "Missing ZIP archive."
            }
            

Causes

You forgot to attach the ZIP archive to the REST request, make sure you send it as a file attached to the query and not as & quot; query string & quot; or in the & quot; body & quot Of the application.

Error message " Corrupted ZIP archive"

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series' -u cstb_test:cstb2014 -F zip=@invalid_test_site-series.zip

            400 BAD REQUEST

            {
                "error": "Corrupted ZIP archive."
            }
            

Causes

The archive you sent is unreadable, please recompress it and send it again.

Error message " ZIP already exist "

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series' -u cstb_test:cstb2014 -F zip=@test_site-series.zip

            400 BAD REQUEST

            {
                "error": "ZIP already exist"
            }
            

Causes

The archive you sent is already present on the server, please rename it and send it again.

Missing "authorization headers"

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series'

            400 BAD REQUEST

            {
                "error": "Missing authorization headers"
            }
            

Causes

You forgot the "username" "password" parameters required for authentication in your query.

Error message "Unauthorized"

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_site/variables/series' -u cstb_test:cstb20123

            401 Unauthorized

            {
                "error": "Unauthorized"
            }
            

Causes

You have misidentified or you do not have access to this information.

Error message " Site not found "

Sample Query

            curl -i -X POST 'https://api.openrj.eu/v1/users/current/sites/test_sit/variables/series' -u ertyui:ertyu

            404 Not Found

            {
                "error":"Site not found."
            }
            

Causes

This site does not exist.