Hi!
Yes it is possible and here is a rudimentary piece of code to help:
Note you would need to create an oauth client on your tenant to be able to use this as described here: Access platform APIs from outside | Dynatrace Developer
then in your Power query connection in Powerbi use the following (this example runs a fetch logs 1000 records DQL query):
let
body = grant_type=client_credentials&client_id=<your oauth client id here>&client_secret=<your oauth secret here>&scope=<your scope required here(e.g. storage:logs:read+storage:buckets:read)>,
Data= Web.Contents(“https://sso.dynatrace.com/sso/oauth2/token”,
[Content=Text.ToBinary(body),
Headers=[#“Content-Type”=“application/x-www-form-urlencoded”]]),
DataRecord = Json.Document(Data) ,
token=DataRecord[access_token],
postBody = <your dql query here, e.g. {“query”: “fetch logs | limit 1000”,“timezone”: “UTC”,“locale”: “en_US”,“requestTimeoutMilliseconds”: 60000,“maxResultRecords”: 1000}>,
Source = Json.Document(Web.Contents(“https://<your DT tenant here>/platform/storage/query/v1/query:execute?enrich=metric-metadata”,
[Headers=[#“Authorization”="Bearer "&token, #“Content-Type”=“application/json”],
Content=Text.ToBinary(postBody)])),
result = Source[result],
records = result[records],
#“Converted to Table” = Table.FromList(records, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#“Expanded Column1” = Table.ExpandRecordColumn(#“Converted to Table”, “Column1”, {“timestamp”, “content”, “container.image.name”, “container.name”, “dt.entity.container_group”, “dt.entity.container_group_instance”, “dt.entity.host”, “dt.entity.process_group”, “dt.entity.process_group_instance”, “dt.process.name”, “dt.source_entity”, “event.type”, “host.name”, “log.source”, “loglevel”, “process.technology”, “status”, “container.id”, “log.iostream”}, {“Column1.timestamp”, “Column1.content”, “Column1.container.image.name”, “Column1.container.name”, “Column1.dt.entity.container_group”, “Column1.dt.entity.container_group_instance”, “Column1.dt.entity.host”, “Column1.dt.entity.process_group”, “Column1.dt.entity.process_group_instance”, “Column1.dt.process.name”, “Column1.dt.source_entity”, “Column1.event.type”, “Column1.host.name”, “Column1.log.source”, “Column1.loglevel”, “Column1.process.technology”, “Column1.status”, “Column1.container.id”, “Column1.log.iostream”})
in
#“Expanded Column1”