Datasource SDT and REST API

  • 17 March 2023
  • 3 replies

Badge +1

I’d like to write a script to accomplish what we can do in the GUI when creating a new SDT, which is to find a datasource and create a global SDT applied to it.

The REST API v3 shows me that we can only create a DeviceDatasourceSDT, which seems to require the device Id of every resource where the datasource has been applied.

This doesn’t make sense. It seems in order to SDT a datasource in the same way the GUI allows us to do, we must iterate through every single resource and their respective device datasources, locate ones that match the datasource I’d ilke to SDT, then SDT each of the corresponding device datasources.

This is madness. Has anyone accomplished anything useful with a datasource SDT using the REST API?

3 replies

Userlevel 2
Badge +3

You can first find the group id (Folder)


Then once you have the group id use this to list all the data sources in the group


Once you have that list you then POST to


Example payload:

{"deviceGroupId":1,"type":"ResourceGroupSDT","sdtType":"oneTime","startDateTime":1679192040000,"endDateTime":1679192100000,"timezone":"Australia/Sydney","comment":"","dataSourceId":"581","dataSourceName":".Net CLR Loader(.NetCLRLoader)"}


That will set SDT on every resource in the group

Badge +1

Thank you for your response. My goal is to add an SDT to every datasource matching a text pattern, as we’ve named them appropriately (they’re all custom datasources).

The devices/resources aren’t relevant, as I want the SDT to apply globally, just to the specific datasources I identify. So I can’t start with a device group, unless I start with the root device group, which seems like a huge overhead. Is there a more direct way to simply SDT specific datasources globally?

Userlevel 6
Badge +14

Applying it to the root is the way to simply SDT specific datasources globally. Group SDT is the only way to do it without setting SDT on each device.