cumulocity

Is there a (documented) way to get attributes from the data point library via API?


In cumulocity cockpit you can specify data point attributes like a display name, unit, value range etc in a so called "data point library". I wonder how I can use these attributes when developing custom dashboard widgets.

I figured out that there is a fragmentType c8y_Kpi for API requests and a class called c8yKpi in the JS client lib which provides all necessary functions. It works fine in my custom widets, but the API/JS class are not documented.

Is there any (official, documented, supported) way to request attributes from the "data point library" via API or JS client library?


Solution

  • These kind of "internal" structures are not documented officially but like you already did you can of course use them in your code. The risk coming with using undocumented structures are that they might change and then you would need to adapt your code.

    Like you already found out yourself the way to get them on API is to call inventory with fragmentType=c8y_Kpi

    /inventory/managedObjects?fragmentType=c8y_Kpi