Dataset API
The dataset
API endpoint allows to get Dataset information, create new Datasets, update existing Datasets, and delete a Dataset.
Prerequisites:
- Set up API access
- Verify that you have API access and obtain a token via get_token call
Table of contents:
See Dataset Data API for information on configuring Dataset data via the dataset_data
API.
1. Access Admin > System > API Toolkit
2. Configure Dataset Info
2.1. Get Dataset Info
- Item: dataset
- Methods: GET
- Enter ID of the Dataset
- If no ID is provided, the API will return the data of all Datasets
- Enter an API Token
- [Run request]
- The returned object contains Dataset's info
- See Example Response and Fields Description for details
{
"id": "63",
"source_dataset_id": "0",
"source_dataset_filter_id": "0",
"name": "Suppliers Analysis",
"description": "Suppliers Analysis",
"measurement_interval": "3",
"data_storage": "1",
"category": "65",
"data_collection_trigger": "1",
"keep_history": "yes",
"measurement_time_source": "Measurement time command",
"can_historical_instances_be_backfilled": "yes",
"weekly_data_for": "Last day of Week",
"custom_effective_date": "19",
"data_source": "57_sql",
"data_fetch_command": "SELECT * from dataset_61\nWHERE date = :measurement_time",
"omit_partial_periods_ind": "no",
"generate_empty_instance_ind": "skip generation",
"has_access_map_ind": "user has access to all rows",
"instances_to_keep": "1095"
}
Fields Description
2.2. Create Dataset
- Item: dataset
- Methods: POST
- Enter ID of an existing Dataset that you want to use as a model for a new Dataset
- After you enter the Dataset ID, the Request field will display the settings for that Dataset
- Select JSON request and modify the new Dataset's data
- See Example Response and Fields Description for details
- Enter an API Token
- [Run request]
- The returned object contains the new Dataset's info
- Note that the new Dataset's ID is auto-created
2.3. Update Dataset Info
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset you want to update
- Select JSON request and modify the Dataset's data
- See Example Response and Fields Description for details
- Enter an API Token
- [Run request]
2.4. Validate Dataset
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset you want to validate
- Actions: Validate
- Enter an API Token
- [Run request]
- If the Dataset is validated successfully, a corresponding message is returned
2.5. Delete Dataset Data
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset which data you want to delete
- Actions: Delete data
- Select JSON request and enter the time interval for which you want to delete Dataset data in the following format:
{
"call": "delete_data",
"delete_measurements_from": "<Date and time from which the Dataset data is deleted>",
"delete_measurements_through": "<Date and time until which the Dataset data is deleted>"
}
- Enter an API Token
- [Run request]
- If the Dataset data is deleted successfully, a corresponding message is returned
2.6. Get Dataset Access Map (User Map)
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset for which you want to get an Access Map
- Actions: Get Access Map
- Enter an API Token
- [Run request]
- If the Dataset's Access Map data is fetched successfully, its data is returned
2.7. Set Dataset Access Map (User Map)
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset for which you want to get an Access Map
- Actions: Set Access Map
- Select JSON request and provide JSON mapping Dataset parameters with User Map parameters
- Enter an API Token
- [Run request]
- If the Dataset's Access Map data is set successfully, a corresponding message is returned
2.8. Enable Dataset
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset you want to enable
- Actions: Enable
- Enter an API Token
- [Run request]
- If the Dataset is enabled successfully, a corresponding message is returned
2.9. Disable Dataset
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset you want to disable
- Actions: Disable
- Enter an API Token
- [Run request]
- If the Dataset is disabled successfully, a corresponding message is returned
2.10. Update Dataset Data
- Item: dataset
- Methods: PUT
- Enter ID of the Dataset which data you want to update
- This action is an equivalent of [Update Dataset] from the Dataset Editor
- Actions: Update Dataset
- Enter an API Token
- [Run request]
- If the Dataset has been updated successfully, a corresponding message is returned