|
Climaps API
version 1
|
Static Public Member Functions | |
| static | addJob () |
| static | getOwnJob () |
| static | getOwnJobs () |
Static Public Attributes | |
| static | STATUS_QUEUED = 1 |
| The job is queued and will be processed as soon as a download slot will be available. | |
| static | STATUS_ONGOING = 2 |
| The job is currently being processed. | |
| static | STATUS_COMPLETED = 3 |
| The job has been completed and data is ready to be downloaded. | |
| static | MAX_DOWNLOAD_RANGE = 315360000 |
| Maximum range in seconds, scale with the number of stations (e.g., 1 station: MAX_DOWNLOAD_RANGE, 2 stations: MAX_DOWNLOAD_RANGE / 2, ...) | |
| static | MAX_CONCURRENT_JOBS = 5 |
| Maximum number of concurrent jobs (queued or ongoing) for a single user. | |
This class lets you asynchronously download large amounts of data as a .zip file.
There is a global queue among all Climaps users where jobs are stored. Once a download slot becomes free, the oldest queued job is processed. Once completed, a zip file with the requested data is generated and the job is removed from the queue.
Usage is as follows:
|
static |
Queue a new download job.
| string | name | The job name |
| int | from | Begining of the time interval, in epoch time |
| int | to | End of the time interval, in epoch time |
| string | stations | The list of stations as a comma-separated string (e.g., '300,652,666') |
| string | fileFormat | Optional The file format: csv, csvxls, or matlab (default) |
| string | dateFormat | Optional The date format: epoch (default), xlstime, plaintext, or iso8601 |
| int | timezoneOffset | Optional Local timezone offset in minutes (e.g., 120 for GMT+2), default is 0 (UTC) |
| string | dataResolution | Optional Resolution of the data, can be either full (default), 15m, 1h, or 1d |
| int | useRaw | Optional Include raw instead of converted values: 0 (default), or 1 |
| int | includeStatus | Optional Include status data (e.g., battery level): 0 (default), or 1 |
| int | includePictures | Optional Include sensorcam pictures: 0 (default), or 1 |
An object such as:
| Property | Type | Description |
|---|---|---|
| success | boolean | Whether the job could be added to the download queue |
| error | string | An error message in case of a failure |
| jobId | int | The id of the new queued job in case of success |
|
static |
Get the status of a particular job.
| int | jobId | Job id |
An object such as:
| Property | Type | Description |
|---|---|---|
| id | int | Job id |
| name | string | Job name |
| status | int | Job status (e.g., downloads::STATUS_ONGOING) |
| progress | float | Percentage of completion, if the job is ongoing |
| epochCreated | int | Creation date in epoch time |
| epochCompleted | int | Completion date in epoch time, if the job has been completed |
| link | string | Download link for the zip file, if the job has been completed |
|
static |
Get the most recent download jobs of the current user.
| int | howMany | Optional Number of jobs to retrieve (defaults to 1) |
An array of objects such as:
| Property | Type | Description |
|---|---|---|
| totalCount | int | Total number of jobs of the user |
| jobs | array | Array of recent jobs |
The jobs are objects such as:
| Property | Type | Description |
|---|---|---|
| id | int | Job id |
| name | string | Job name |
| status | int | Job status (e.g., downloads::STATUS_ONGOING) |
| progress | float | Percentage of completion, if the job is ongoing |
| epochCreated | int | Creation date in epoch time |
| epochCompleted | int | Completion date in epoch time, if the job has been completed |
| link | string | Download link for the zip file, if the job has been completed |
1.8.8