/api/data
RESTFUL API specification defined here for custom data management related operations.
The following resources are applicable:
/data/{tableName}
The following operations are supported on this resource:
GET
This method returns the custom table definition in json or xml format.
Example: The following query using GET
matelive/api/data/TABLE1
returns the table definition that may look something like (in JSON format):
{
  "tableDefinition": {
    "name": "TABLE1"
    "display": "TABLE1",
    "columnsMetaData": [
      {
      "name": "name",
      "dataType": "text",
      "display": "col1",
      "isKey": "true",
      "isVisible": "true"
      }
    ],
    "seriesMetaData": [
      {
      "name": "tsName1",
      "display": "tsName1",
      "dataType": "int",
      "freq": "HF",
      "isVisible": "true"
     }
    ]
   ]
  }
}
          
      Parameters
| name | description | type | default | 
|---|---|---|---|
| tableName | name of the table | path | 
Response Body
| element: | tableDefinition | 
| media types: | text/plain application/json  | 
        
table definition
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable | 
POST
This method creates a new table and returns the table name after created.
JSON Example: the following request using POST will create a table named TABLE1.
matelive/api/data/TABLE1
{
  "name": "TABLE1",
  "display" : "TABLE1",
  "columnsMetaData": [
    {
    "name" : "col1",
    "display" : "Col1",
    "dataType" : "text",
    "isKey" : "true",
    "isVisible" : "true",
    "customProperties" : [
      {
      "name" : "allowNull",
      "value" : "yes"
      }
    ]
    }
  ],
  "seriesMetaData": [
    {
    "name": "tsName1",
    "display": "tsName1",
    "freq": "LF",
    "dataType": int
    }
  ]
}
          
      Request Body
| element: | json | 
| media types: | text/plain application/json  | 
        
(no documentation provided)
Response Body
| element: | (custom) | 
| media types: | */* application/xml  | 
        
returns table name
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable | 
PUT
This method adds a column or columns to an existing custom table.
JSON Example: the following request using PUT will add two time series columns into TABLE1.
matelive/api/data/TABLE1
seriesMetaData": [
  {
  "name": "tsName4",
  "display": "tsName4",
  "dataType": "int",
  "isVisible": "false",
  "freq": "LF",
  "customProperties": {
    "name": "allowNull",
    "value": "true"
    }
  },
  {
  "name": "tsName5",
  "display": "tsName5",
  "dataType": "int",
  "isVisible": "false",
  "freq": "HF"
  }
]
          
      Parameters
| name | description | type | default | 
|---|---|---|---|
| tableName | name of the table to add columns into | path | 
Request Body
| element: | json | 
| media types: | text/plain application/json  | 
        
(no documentation provided)
Response Body
| element: | (custom) | 
| media types: | */* application/xml  | 
        
returns table name
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable | 
DELETE
This method deletes the table.
Example: The following query using DELETE
matelive/api/data/TABLE1
deletes the table named TABLE1.
Parameters
| name | description | type | default | 
|---|---|---|---|
| tableName | name of the table to be dropped | path | 
Response Body
| element: | (custom) | 
| media types: | */* application/xml  | 
        
returns table name
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable | 
/data/{tableName}/{columnName}/status
PUT
This method activates or deactivates a column in the existing custom table.
Example: The following query using PUT
matelive/api/data/TABLE1/col1/status?isActive=false
deactivates the column col1 in TABLE1.
Parameters
| name | description | type | default | 
|---|---|---|---|
| tableName | name of the table to be updated | path | |
| columnName | name of the column to activate or deactivate | path | |
| isActive | true to activate or false to deactivate | query | 
Response Body
| element: | (custom) | 
| media types: | */* application/xml  | 
        
returns table name
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable | 
/data/{tableName}/import
POST
This method imports data into the custom table.
Example: The following query with POST
matelive/api/data/TABLE1/import
 with multipart/form as input parameter which has 3 input elements: 
1. Optional input element 'time' to specify the timestamp to update data. Format of the timestamp should be 'yyyy-MM-dd HH:mm:ss'; 
2. Optional input element 'update' - this input element with any string value indicates the POST request is to modify existing data; 
3. Required input element 'attachment' which has data attached to be inserted into or updated TABLE1
Below is an example of data in the attached file:
ts name col2 tsName1 2013-01-01 10:00:00 nodeA-B-C 5 3 2013-01-01 10:15:00 nodeA-B-C 5 13 2013-01-01 10:15:00 nodeD-B-C 6 4 2013-01-01 10:30:00 nodeE-B-C 7 2 2013-01-01 10:45:00 nodeE-B-C 7 10
Below is an example of data in the attached file with 'update' set to a string, (e.g., UPDATE), to modify the value in tsName3:
ts name tsName3 2013-01-01 10:15:00 nodeA-B-C 73
Parameters
| name | description | type | default | 
|---|---|---|---|
| tableName | name of the table for data to be imported | path | 
Request Body
| element: | input | 
| media types: | multipart/form-data | 
content of the input file
Response Body
| element: | (custom) | 
| media types: | */* application/xml  | 
        
returns Job ID which could be used to track the data import status
Status Codes
| HTTP Status Code | Description | 
|---|---|
| 200 OK | OK; the resource was found | 
| 400 Bad Request | bad or malformed request | 
| 404 Not Found | the resource does not exist | 
| 406 Not Acceptable | required representation is not supported by the server | 
| 500 Internal Server Error | internal server error | 
| 503 Service Unavailable | service is unavailable |