So, I'm very proficient with the API, but this requires a little more detail, because it's very confusing.
So, based only on the information provided by the API, I want to extract the trendings from a table. For that, I'm trying to do the following path:
ConnectApp > GetParametersForElement (which ones are defined externally) > GetTableForParameter > GetTrendDataForTableParameter
Until the last step, everything is fine. But the return from GetTableForParameter is as follows:
(this is a single line. Imagine a few hundred of those)
{'DataMinerID': <censored_value>, 'ElementID': <censored_value>, 'ParameterID': 8002, 'Index': -1, 'IndexValue': '<censored_value>', 'DisplayIndex': -1, 'DisplayIndexValue': <censored_name>, 'TrendKey': '<censored_value>', 'Position': 88, 'AlarmState': 'Normal', 'Cells': None, 'LastChangeUTC': 1764363757771}
GetTrendDataForTableParameter requires a "tableIndex". In that field, I tried to use 'DisplayIndexValue', but the API says I'm wrong, with:
{'Message': 'Received invalid trend data.', 'StackTrace': '', 'ExceptionType': 'Skyline.DataMiner.Web.Common.WebApiException'}
I would guess its 'DisplayIndex', but every single one is -1. So, I'm not sure which of those I should try instead.
Typically the DisplayIndexValue (= display key) should be used, but depending on the type of table (advanced naming or direct view) the IndexValue (= primary key) should be used instead. To make it easier, the TrendKey should always contain the correct value to use as tableIndex on the GetTrendData web methods.
Note that the call can fail if trending isn't enabled on this parameter and there's no trend data available in the database. The GetTableForParameter result includes a IsTrending flag on every cell that will be true when trending is enabled for this column parameter/row.