16 Aug 2024
Tandem API – Deleting Stream Data
In this article, you’ll learn how to delete stream data in Tandem via the API.
This is the last article in our mini-series focusing on streams. In previous articles, we covered several topics:
Introduction
In this article, you’ll learn how to delete stream data. While this is usually unnecessary—since incorrect data can be overridden by submitting new data—there are scenarios where deletion is required.
It’s important to note that deletion is an irreversible action; once data is deleted, it cannot be restored.
There may be scenarios where you need to delete existing data from streams—for example, if the data contains incorrect timestamps. In such cases, you can use the following API to delete stream data:
POST timeseries/models/{modelID}/deletestreamsdata
The modelID parameter refers to the ID of the default model, which shares the same URN as the facility but with a different prefix. For example:
Facility URN: urn:adsk.dtt:mprWPFSnT82G1ILC_4dWgA
Default model URN: urn:adsk.dtm:mprWPFSnT82G1ILC_4dWgA
The input payload is a list of stream keys:
{
"keys ": [
"A07U_DvETBaVeRU4bB61yAAAAAA",
"CoMddqQ9TQWgO78W8AR_nQAAAAA",
"DFVkxdNRTdi3RJzEtiepWgAAAAA",
"LkZs51ULTgy_CDot8yT8egAAAAA",
"MFeNHb1bRyOY_R3X_6xcqAAAAAA"
]
}
Delete all stream data
The simplest case is when you need to delete all data for a given stream or multiple streams. In this case, you can use the allSubstreams parameter to specify that data for all parameters should be deleted:
POST timeseries/models/{modelID}/deletestreamsdata?allSubstreams=1
You can also optionally use the from and to parameters to specify a time range for deletion. These parameters should be specified using the date format yyyy-MM-dd, e.g.:
POST timeseries/models/{modelID}/deletestreamsdata?allSubstreams=1&from=2024-08-07&to=2024-08-08
Delete data for specific parameters
The API also allows for the deletion of data for specific parameters. In this case, you can use the substreams parameter and provide a comma-separated list of parameter IDs, e.g.:
POST timeseries/models/{modelID}/deletestreamsdata?substreams=z:Dg
You can also use from, to parameters to optionally specify time range for deletion.
Wrap up
In this article, you learned how to use the Tandem API to delete stream data. You can find related examples below:
JavaScript:
Python
Follow us on @Twitter and feel free to contact us in case of any questions or if you need any help with the Tandem API: aps.help@autodesk.com. You can also submit your questions via StackOverflow and mark them using autodesk-tandem tag.